This seems like it may be impossible, but I thought I would ask anyway.
I have defined a boost::variant
like this:
typedef boost::variant<double, int, std::string> ConfigVariant;
Later in my code I define a std::map
like this:
std::map<std::string, ConfigVariant> my_map;
Now I would like to be able to have std::map<std::string, ConfigVariant>
values inside my_map
. For example, I would like to do this:
my_map[key1][key2] = "hello world";
The reason I think this is impossible is because it seems like the corresponding variant definition would look like this:
typedef boost::variant<double, int, std::string, std::map<std::string, ConfigVariant> ConfigVariant;
Since making such a type definition would be impossible, is there any way around this?