title: How to access the first element of std::list?
body: <p>I have a list <code>std::list&lt;T *&gt; *l;</code>. this list is not null and has some values. My problem is how to access items properly? i do not need to iterate over the list. i just want the first item only.</p>
  
  <pre><code>std::list&lt;T*&gt;::iterator it = l-&gt;begin();
  
  if (it != l-&gt;end())
  {
      // accessing T
      int value = (*it)-&gt;value(); // Is this safe?
  }
  </code></pre>
  
  <p>or should i check for null also?</p>
  
  <pre><code>if (it != l-&gt;end() &amp;&amp; (*it))
  {
      // accessing T
      int value = (*it)-&gt;value();
  }
  </code></pre>