c++ - Registry of different types of data -


i want keep kind of container type maps 1 value of type. want std::map<std::typeindex, t> t depends on type index with. std::map doesn't nice way of doing because types rigid. simplest solution can use doing this?

if map type-erased container boost::any, can @ least recover type if know is:

std::map<std::typeindex, boost::any> m;  m[typeid(foo)] = foo(1, true, 'x');  foo & x = boost::any_cast<foo&>(m[typeid(foo)]); 

Comments

Popular posts from this blog

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

c++ - CryptStringToBinary API behavior -