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
#include #include #include #include int main() { try { std::map m; m["a"] = 2; m["b"] = static_cast("black sheep"); int i = boost::any_cast(m["a"]); std::cout << "I(" << i << ")\n"; int j = boost::any_cast(m["b"]); // throws exception std::cout << "J(" << j << ")\n"; } catch(...) { std::cout << "Exception\n"; } }