I would like to have std::hash_map , which maps (for example) regular std:string to several different specializations of another template class.
This example is what I'm trying to achieve (this is incorrect and does not compile):
template<typename T> class Foo { public: Foo(T _value) { this-> value = _value; } private: T value; }; int main() { hash_map<string, Foo> various_foos; various_foos["foo"] = Foo<int>(17); various_foos["bar"] = Foo<double>(17.4); }
source share