Basically what I want to do is as follows. Let's assume we have a template member function foo:
template <typename T>
T SomeClass::foo();
and somehow a user passed map< string, int > as a template argument:
foo<map<string, int>>();
What I want to do here is, when defining the function foo, to get the inner types, string and int. I tried much guesswork to un-specialize the argument but was of no avail.
template <map<typename K, typename V>>
map<K, V> SomeClass::foo(); // absolutely illegal
I thought about using partial specialization, but it didn't work as foo is a class member function.
template <typename K,typename V> map<K,V> SomeClass:foo();- 463035818_is_not_a_numberT::key_type/T::mapped_type? - Jarod42Tbe any type, or onlystd::map. If you don't have specialization, what do you expect fromfoo<int>? - Jarod42