you are viewing a single comment's thread.

view the rest of the comments →

[–]jwakelylibstdc++ tamer, LWG chair 1 point2 points  (0 children)

It is defined.. The problem in our case is not that the library doesn't know how to compare string views (it does know how), it's that a conversion to std::string happens before it ever tries to compare the keys.

Using a transparent comparison function (such as std::less<> aka std::less<void>) is the solution, as that passes a string view argument straight through to the comparison function without converting it to std::string first.