title: Check if the element is the first or the last one in an std::vector
body: <p>I have the following <code>for each</code> C++ code:</p>
  
  <pre><code>for (auto item : myVector)
  {
      std::cout &lt;&lt; item;
  
      if (item == orderBy.IsLast())       // &lt;--- Check if this is the last element
          std::cout &lt;&lt; "(Is last element) " &lt;&lt; std::endl;
      else if (item == orderBy.IsFirst()) // &lt;-- Check if this is the first element
          std::cout &lt;&lt; "(Is first element)" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Of course <code>IfLast()</code> and <code>IfFirst()</code> do not exist on <code>std::vector</code>. Is there a native <code>std::</code> way to check for first and last element ?</p>