|Anyways, better to use the language how it was designed, and not try to hack it to make it fit your need.|
actually, i think this is called creativity, not hacking.
|But why would you need a container to hold vastly different data types?|
in my current project, i needed a class member that is publicly accessible for read operations, but private for write operations, when i searched for such thing i saw that programmers didn't give much attention on the topic.
they claimed that this property doesn't have real applications, so it's not important to be included into C++, but i found an application for it.
i know that python is an interpreted language, means that the vector isn't created untill the specific declaration line is reached, then it is created with the required type.
in C++, this isn't the case, C++ is a compiled language, this means the compiler determines everything about data types before the execution of the program.
this way, you can't define any object which type is generic.
although as ResidentBiscuit
stated about superclass that is the base of all types:
C++/CLI programming defines all data types -including built-in types- as classes derived from a super class System::Object
maybe you can use this to achieve your goal, program under CLR and define the vector as:
this way, the members of the vector can point to any type.