title: C++: overloading list.end() and list.begin() methods for constant iterators
body: <p>I'm still trying to implement my own version of LinkedList class and now I have problems with overloading methods for constant iterators. For example, when I try to print out list using this code:</p>
  
  <pre><code>cout &lt;&lt; "citer:" &lt;&lt; endl;
  for (UberList&lt;int&gt;::CIter it = ulist.begin(); it != ulist.end(); ++it)
  {
   cout &lt;&lt; *it &lt;&lt; " ";
  }
  cout &lt;&lt; endl;
  </code></pre>
  
  <p>I have these errors:</p>
  
  <pre><code>Error E2034 UberList2.cpp 532: Cannot convert 'UberList&lt;int&gt;::Iter' to 'UberList&lt;int&gt;::CIter' in function main()
  Error E2094 UberList2.cpp 532: 'operator!=' not implemented in type 'UberList&lt;int&gt;::CIter' for arguments of type 'UberList&lt;int&gt;::Iter' in function main()
  </code></pre>
  
  <p>so as far as I understood, it means that those usual end and begin iterator methods are used. Here's how these methods are declared in my class:</p>
  
  <pre><code>Iter begin();
  Iter end();
  CIter begin() const;
  CIter end() const;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>template&lt;class T&gt;
  typename UberList&lt;T&gt;::Iter UberList&lt;T&gt;::begin()
  {
      Iter it;
      it.curr = head;
      return it;
  }
  
  template&lt;class T&gt;
  typename UberList&lt;T&gt;::Iter UberList&lt;T&gt;::end()
  {
   Iter it;
   it.curr = tail-&gt;next;
   return it;
  }
  
  template&lt;class T&gt;
  typename UberList&lt;T&gt;::CIter UberList&lt;T&gt;::begin() const
  {
   CIter it;
   it.ccurr = head;
   return it;
  }
  
  template&lt;class T&gt;
  typename UberList&lt;T&gt;::CIter UberList&lt;T&gt;::end() const
  {
   CIter it;
   it.ccurr = tail-&gt;next;
   return it;
  }
  </code></pre>
  
  <p>Is there any way I can force my program to use these const methods for constant iterators instead of usual ones? I'd be glad to hear any advice.</p>
  
  <p>Oh and here's the code of my class in one file just in case: <a href="http://pastebin.com/Jbvv5Hht" rel="nofollow">http://pastebin.com/Jbvv5Hht</a></p>