
30 Aug
2009
30 Aug
'09
4:39 p.m.
Archie14 wrote:
given the class like the one below:
template <typename T> class animal { public: animal (const char* ofname) : _name(ofname) {} private: typedef T _T; std::string _name; _T behavior; }
class MeatEater {}; class GrassEather {};
animal<MeatEater> bear ("bear"); animal<GrassEater> rabbit ("rabbit");
How to store "bear" and "rabbit" instances in a vector? Advise is greatly appreciated Do you knwo in advance how many "Eater" type you'll have ? If yes : do a std::vector of boost::variant If no : do a std::vector of boost::any
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35