3
3doutpost
is there a way to write a class that will be used to store a list of
things so that you can pass in the STL container type and it will be
filled with the right thing - something like (if it were legal) ...
std::vector < std::string > aList;
funkyList* theList = new funkyList < aList >;
theList->populate ();
std::vector < std::string >::iterator iter = theList->getIterator ();
.... hmmm.. as i'm writing that i realzie it's not making sense...
what i'm trying to do is allow consumers of the class to use any
storage they like and not enforce a std::vector, std::list etc...
maybe i need to just return my own iterator to the list and allow the
class consumer to do with each element what it wants rather than
returning the whole list.
comments appreciated.
things so that you can pass in the STL container type and it will be
filled with the right thing - something like (if it were legal) ...
std::vector < std::string > aList;
funkyList* theList = new funkyList < aList >;
theList->populate ();
std::vector < std::string >::iterator iter = theList->getIterator ();
.... hmmm.. as i'm writing that i realzie it's not making sense...
what i'm trying to do is allow consumers of the class to use any
storage they like and not enforce a std::vector, std::list etc...
maybe i need to just return my own iterator to the list and allow the
class consumer to do with each element what it wants rather than
returning the whole list.
comments appreciated.