serge-sans-paille / frozen

a header-only, constexpr alternative to gperf for C++14 users
Apache License 2.0
1.27k stars 103 forks source link

feature: heterogeneous lookup #140

Closed impugachev closed 2 years ago

impugachev commented 2 years ago

This PR adds heterogeneous lookup for unordered containers(set,map). Now you can search for another type in 2 ways:

  1. Use special find (and other functions) signature and pass hash and equal functions.
  2. Create a container with heterogenous frozen::elsa<> and std::equal_to<>.

To my surprise, ordered map already have heterogeneous lookup, but I don’t understand why there are such overcomplications from my point of view as CompareKey. I think we need to refactor this and add a lookup for set separately.

serge-sans-paille commented 2 years ago

Thanks for the patch, which looks good to me. And I agree with the simplification you propose. Can you handle it?

impugachev commented 2 years ago

Yes, I will try to do it soon.