[Solved] Map::insert does not work [closed]


See the reference:

template<
    class Key,
    class T,
    class Compare = std::less<Key>,
    class Allocator = std::allocator<std::pair<const Key, T> >
> class map;

http://en.cppreference.com/w/cpp/container/map

An std::map takes a comparator that tells if the first argument is less than the second. Not if they are equal. Otherwise it could not build a binary tree.

You don’t need to write your own comparator for std::string at all. All the comparison operators are already defined for you: http://en.cppreference.com/w/cpp/string/basic_string/operator_cmp.

solved Map::insert does not work [closed]