list of template class objects

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manu1001
    New Member
    • Jul 2007
    • 14

    list of template class objects

    i have a template class definition.

    Code:
    template <class T> 
    class ab
    { 
       ...
    };
    how do i declare a list of type ab using STL's list container.
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    You use list<ab<T> >. You have to leave the space between the >, otherwise the compiler misinterprets it as the >> operator...

    Comment

    • manu1001
      New Member
      • Jul 2007
      • 14

      #3
      thanks, it works.
      another problem, i'm not able to declare an iterator in the same way.

      Code:
      std::list<MyClass<T> >::iterator i;
      gives an error: "expected ';' before i".

      Comment

      Working...