title: Abstract iterator for underlying collections
body: <p>So basically what I want to do is to have a pure virtual method returning an iterator to an arbitrary collection of a concrete type, e.g in pseudo code:</p>
  
  <pre><code>virtual Iterator&lt;T&gt; getIterator() const = 0;
  </code></pre>
  
  <p>The user of this class actually don't care what implementation the child class uses. It could be a set, vector, list, array etc.</p>
  
  <p>I'm aware of the <code>std::iterator</code> class but I cant find a way to specify it correctly in order to work with a simple vector.</p>
  
  <pre><code>virtual std::iterator&lt;std::random_access_iterator_tag,T&gt; getIterator() const = 0;
  
  myVector.begin() // compilation error in implementation
  </code></pre>
  
  <p>defining <code>std::iterator</code> with <code>const T</code> as type parameter hasn't worked too. I also tried leaving <code>T</code> and instead defining the pointer and reference types as <code>const T*</code> and <code>const T&amp;</code>.</p>
  
  <p>By taking  a look at the <code>std::vector</code> implementation, I found out that <code>std::vector::const_iterator</code> actually derives from <code>_Iterator012</code> deriving from <code>_Iterator_base</code>.</p>
  
  <p>It really bugs me that there isn't any way to work with arbitrary collections in std.
  Implementing my classes as templates like in <code>&lt;algorithm&gt;</code> is not an option for me due two reasons:</p>
  
  <ul>
  <li>No control over the actual value type</li>
  <li>I simply don't want to make my classes templates complicating my design a lot and making things less flexible.</li>
  </ul>
  
  <p>The used type parameter <code>T</code> was just for demonstration, actually this is a concrete type.</p>