Hi there! I'm trying to start learning C++ and I have a problem.
I'm trying to create a function template,
template<multimap<string, double> arr>
void calculate(string key) {
}
and use it like this:
multimap<string, double> arr;
vector<string> keys;
// ...
for_each(keys.begin(), keys.end(), calculate<arr>);
But i doesnt'complile:
Illegal type for non-type parameter, etc Please, help me. How to arhive the behavior I expect? I really don't want to create a callback for every for_each, etc. (Maybe, closures have made me more lazy than it needed for C++ and I have to, but I don't want to believe) (btw, is there a way to get a vector with keys from multimap?)
I've tried
typedef multimap<string, double> my_map;
template<my_map arr>
still doen't work