title: how can i check if the iterator come to the end of list?
body: <p>i have this code:
  and i want on the function run on all over the list and print it</p>
  
  <p>but i don't want to send the list to the function</p>
  
  <p>i want to send only the iterator</p>
  
  <p>but the problem it the on the "for" i cant do </p>
  
  <pre><code>it_mylist != it_mylist.end()
  </code></pre>
  
  <p>what can i do please?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  #include &lt;list&gt;
  
  void f(list&lt;int&gt;::iterator it_mylist)
  {       
      for (; it_mylist != it_mylist.end(); ++it_mylist)
      {
          cout &lt;&lt; *it_mylist;
      }  
  }
  void main()
  {   
      list&lt;int&gt; mylist;
      mylist.push_front(1); mylist.push_front(2); mylist.push_front(3); 
  
      list&lt;int&gt;::iterator it_mylist = mylist.begin();
      f(it_mylist);  
  }
  </code></pre>