Scary multimap behaviour
public text v1 · immutable#include <map>
#include <string>
#include <iostream>
struct comparestrings
{
bool operator()(const std::string & left, const std::string & right) const { return left.compare(right); }
};
main()
{
std::multimap<std::string, std::string, comparestrings> testmap;
testmap.insert(std::pair<std::string, std::string>("key1", "value1"));
std::cerr << testmap.count("key2") << std::endl; // <-- why does this print "1"?!?!
}