I said:
Mirek could have said
std::vector<boost::any> x;
The implementation of which you can find at
http://boost.org/doc/html/any.html
This still skirts the question at any rate. The question was how would
you implement a container that can contain anything. The point of
which was to point out the complexity of such a thing in C++. As I
already pointed out it is certainly possible, since you can do anything
in any language, and boost provides tools to use that make it easy on
the end developer, but what is underneath boost::any, how much of the
static type safety remains while using it, and can it truely hold
anything or are there limits?
Simply pointing to someone else's implementation neither answers the
question nor shows any insight or knowledge of the underlying issues
whatsoever. It must also be pointed out that the container isn't
containing any value of any type...it is containing objects of type
boost::any, which can hold various unrelated types. This in itself
points out the added complexity necissary to create such containers in
a statically typed environment.
There are benefits and issues either way. Saying one is better or that
you can do X in only one or the other is just ignorance.