I want to have a map that has a homogeneous key type but heterogeneous data types.
I want to be able to do something like (pseudo-code):
boost::map&l
Thank you David, that was what I needed. Here's the working solution.
#include using std::cout; using std::endl; #include #include using boost::any_cast; typedef std::map t_map; int main(int argc, char **argv) { t_map map; char *pc = "boo yeah!"; map["a"] = 2.1; map["b"] = pc; cout << "map contents" << endl; cout << any_cast(map["a"]) << endl; cout << any_cast(map["b"]) << endl; return 0; }