title: C++ right way of returning a generic collection of type
body: <p>I'm new to C++, and unfortunately I cannot stop thinking in C# (my former language).
  I read some books, forums and the C++ reference website, but I couldn't find an answer to my question, so I thought I might as well try here before giving up and writing something ugly.</p>
  
  <p>Ok, we can start.
  I have a class with an abstract method <strong>succesorsFunction</strong> and I would like it to return a collection of pointers to <strong>State</strong>. I don't want to force the implementors to a specific container; I rather let them choose (vector, list, etc).</p>
  
  <p>So it looks like this:</p>
  
  <pre><code>class Problem
  {
  public:
      virtual list&lt;const State*&gt;::iterator succesorsFunction(const State &amp;state, list&lt;const State*&gt;::iterator result) const = 0;
  };
  </code></pre>
  
  <p>the problem here is the explicit use of list. How do you do it in C++?</p>
  
  <p>I thought about using templates, but then I encountered two problems:
  1) It seems like you cannot do it with abstract methods (or am I wrong?)
  2) How do I tell the template it should contain pointers to State?</p>