I have to question why you'd want to do this. Unless you are doing this for academic / experimental purposes and your planning to throw it away, you're making work for yourself and are almost certain to end up with code which is more vulnerable to problems than if you used facilities that the language and STL already offer. In C, you'd probably have to do this, but with C++ you don't have to as the language support is there.
There are two aspects to what you're doing: Having elements of any type that can be used generically in some defined way and collecting those elements up together. Then first aspect can easily be acheived by polymosphism. Create an abstract base class which defines a common interface:
struct BaseElement { virtual void doSomething( ); };
Then you can derive structs from this which cover what your elements are doing:
struct DerivedElement1 : public BaseElement { void doSomething( ); };
struct DerivedElement2 : public BaseElement { void doSomething( ); };
To collect the types together, you can simply use an STL vector. It provides all of what you need as far as I can see. As a very simple example, you could do the following:
// Convenient shorthand.
typedef std::vector< std::shared_ptr<BaseElement> > MyElements;
MyElements m;
// Create two different but commonly derived objects.
std::shared_ptr<DerivedElement1> e1(new DerivedElement1);
std::shared_ptr<DerivedElement2> e2(new DerivedElement2);
// Push them onto the collection.
m.push_back( e1.static_pointer_cast<BaseElement>( e1 ) );
m.push_back( e2.static_pointer_cast<BaseElement>( e2 ) );
At this point you've got everything you need. Vector provides standard functionality such as begin(), end() and size() which help you to traverse the collection and run STL algorithms on it if you so wish. The fact that the collection is polymorphic means that you can run doSomething() on each element knowing it will perform only what was defined for that struct.
(I've not got acccess to a C++11 compiler so I'm sure someone will pick me up on something here. However, the same thing can easily be acheived with pre C++11 code even using raw pointers if you're careful to clear down your objects properly.)
I know this isn't the answer you directly wanted, but I just wanted to emphasise that unless you're simply trying to learn with throw away examples, it's almost always faster, shorter, safer and more reliable to use what's already there.
std::vector<boost::any>.