advice with containers and data types

Hi all, i am a newbie to boost and hope, somebody here can give me an advice. i want to change the implementation of an existing container class in one of my projects. It is a container which for the moment is based on a very old roguewave version which should be replaced by boost. main features of this container are: - the container is based on a hashmap. - the key datatype can be string or int. - the value data type can be string, int, double, time, date, the container type itself and another container type. I thought about implementing the class based on a map container with boost:any as key and value type. is this possible? Or do you have other and even better recommendations for me? i am a bit confused about the great number of diferent containers and datastructures the boost library offers. Thanks in advance, Georg

Since the number of possible concrete types for the key and value are fixed, you may want to consider using boost::variant [1] instead of boost::any. For the value type, take a look at recursive variants. Regards, Nate [1] http://www.boost.org/doc/libs/1_51_0/doc/html/variant.html [2] http://www.boost.org/doc/libs/1_51_0/doc/html/variant/tutorial.html#variant....
participants (2)
-
Georg.Kellerer@lfu.bayern.de
-
Nathan Ridge