I need to create a map that can contain as its value any basic data type such as double,float,string, char etc… to store values from a request for a server component.
I was thinking of using a map such as this: std::map<std::string, void*>, however I don’t know that this is a very good solution.
I wondered if anyone can advice on a better solution. The main point is that the values have to be in the same map.
Please advice?
You could use
boost::anyas the value which can hold “any” type.(It is better to use
boost::variantif there are only finitely many “basic data types”)