
30 Aug
2009
30 Aug
'09
10:03 p.m.
On Sun, Aug 30, 2009 at 11:47 AM, joel
Archie14 wrote:
Well, how would I declare std::vector? std::vector<what>? Using boost::any will require me to do some sort of type discovery at run time. Thanks for pointing the boost::variant to me; that will work.
std::vector< boost::variant
> v;
Or instead of Boost.Any, create a base class for it all called like AnimalBase that is non-templated, then your above templated Animal class will be as it is, but subclasses from Animal, then put abstract calls or whatever similar functionality in AnimalBase to link it all. Variant is faster all around if you know all of your types before hand.