I want to improve my existing library of a Data Set in which I can store variables of any kind, accessible by hash function via a key (string). Goal is to access variables across translation different translation units without passing them as input (to allow compilation independency). Only the singleton object of this DataSet will be passed as argument.
The variables stored in the hash table are of type "My_Variable", which is a class containing the various types I possibly want to store. It also has a variable "Type" to set the type, in order to select between the right overloaded Set and Get functions.
To store classes, I derive all classes from my GenericContainer type, and store pointers to this class in the Data Set. By polymorphism I can then access the data members / functions of the derived classes. I know these should have been smart pointers, this is for future development.
BUT: Somewhere there is this small voice telling me that a library like Boost should have this implemented.
I was looking for boost::unordered_map , but this map (as well as the std::map / std::set) can only store one type of variables in a hash table. I want to store no matter what variable.
Does there exist a nice solution for this in Boost / Loki / STL / ... ?
Thanks in advance for your answer!!!