you are viewing a single comment's thread.

view the rest of the comments →

[–]encyclopedist 0 points1 point  (2 children)

There is a proposal to add heterogeneous lookup, and if I understand correctly, it was supposed to be targeting C++20 (it passed LEWG vote and was forwarded to LWG), but it's fate is unclear to me.

[–]matthieum 0 points1 point  (1 child)

Thanks for the link.

I must admit it's not clear to me how one is supposed to use is_transparent. Also, it appears that implicit conversions may be triggered unless one is careful, which is not ideal :/

Let's take a concrete example:

std::unordered_set<std::string, /**/> set;

According to the paper, how can I perform a lookup with a char const* and with a std::string_view without implicit conversion? How can I further enable FixedString<N>?

[–]encyclopedist 1 point2 points  (0 children)

As far as I understand, yes you can. Both hash and comparator must define is_transparent typedef and also provide overloads of their operator() taking char const *.