Does the map::find method support case insensitive search? I have a map as follows:
map::find
map > directory; <
map > directory;
For C++11 and beyond:
#include #include #include namespace detail { struct CaseInsensitiveComparator { bool operator()(const std::string& a, const std::string& b) const noexcept { return ::strcasecmp(a.c_str(), b.c_str()) < 0; } }; } // namespace detail template using CaseInsensitiveMap = std::map; int main(int argc, char* argv[]) { CaseInsensitiveMap m; m["one"] = 1; std::cout << m.at("ONE") << "\n"; return 0; }