Hopefully this is a quick and easy question to answer. Do I need the bool(*)(char,char) in my typedef below, or can I just use multimap<char,char>::iterator in order to use mmIt iterators with the map mmap? Thanks for the help!
Code snippet:
bool fncomp (char lhs, char rhs) {return lhs < rhs;}
typedef multimap<char,int,bool(*)(char,char)>::iterator mmIt;
multimap<char,int,bool(*)(char,char)> mmap(fncomp);
If
multimap<K,V,Comp>::iteratoris a typedef for something else that doesn’t depend on the comparator type, you might be ok – but this is an implementation detail, and will definitely break if it’s a genuinely nested type.Just sidestep it:
and avoid writing out the whole multimap parameter list everywhere.