Get value type of std::map which passed to template function
c++, dictionary, templates
Solution
`std::map` defines the member types `key_type` and `mapped_type`.
What you want is `B::mapped_type`, which will be `double` in your case.
Problem
Having a template function - ``` template <class B> B getValue (B& map) { // implementation ... } ``` To this function a pass a `map` , like - ``` map<string,double> doubleMap; getValue (doubleMap); ``` So for example in this case, if I want to set the return value of the function to `double` according to `doubleMap` I should extract the `value` type of this `map` , also if I want to declare on a double (or any other type according to the passed map) I must have this .. How can I get it ?