title: Return type of list front (C++)
body: <p>So I want to use a list for a part of my program. I'm trying to get acquainted to the library <em>list</em>, so I wrote a quick little program to help myself understand what's going on. It all works properly, but there's one thing I don't understand.</p>
  
  <p>According to this:
  <a href="http://www.cplusplus.com/reference/list/list/front/" rel="nofollow">http://www.cplusplus.com/reference/list/list/front/</a>
  The return type for the front function should be a <em>reference</em> of the type (in this case, room) of the first element (the only element in this case).</p>
  
  <p>But I was able to access the values without having to reference, because it seems that all the values were passed directly (not by reference). Is this expected? Is the website wrong? Is my compiler wrong (CodeBlocks 13.12)?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;list&gt;
  using namespace std;
  
  struct room {
      int content;
      struct room * north;
      struct room * south;
      struct room * east;
      struct room * west;
  } ;
  
  int main ()
  {
      list&lt;room&gt; mylist;
      cout &lt;&lt; ( mylist.empty() ? "List is empty.\n" : "List is not empty.\n" ) &lt;&lt; endl;
  
      room * room1 = new room;
      room1-&gt;content = 15;
      cout
      &lt;&lt; room1-&gt;content &lt;&lt; "\n"
      &lt;&lt; room1-&gt;north &lt;&lt; "\n"
      &lt;&lt; room1-&gt;south &lt;&lt; "\n"
      &lt;&lt; room1-&gt;east &lt;&lt; "\n"
      &lt;&lt; room1-&gt;west &lt;&lt; "\n";
  
      cout &lt;&lt; "\n" &lt;&lt; room1 &lt;&lt; endl;
  
      mylist.push_front(*room1);
      cout &lt;&lt; ( mylist.empty() ? "\nList is empty.\n" : "\nList is not empty.\n" ) &lt;&lt; endl;
  
      delete room1;
  
      room test_room = mylist.front();
  
      cout
      &lt;&lt; test_room.content &lt;&lt; "\n"
      &lt;&lt; test_room.north &lt;&lt; "\n"
      &lt;&lt; test_room.south &lt;&lt; "\n"
      &lt;&lt; test_room.east &lt;&lt; "\n"
      &lt;&lt; test_room.west &lt;&lt; "\n";
  
      cout &lt;&lt; "\n" &lt;&lt; &amp;test_room &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>