Opened 6 years ago
Last modified 5 years ago
#12765 new Feature Requests
Provide heterogeneous lookup methods using the container's hasher and/or comparator functions
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | intrusive |
Version: | Boost 1.63.0 | Severity: | Optimization |
Keywords: | Cc: | fdegros@… |
Description
Boost intrusive containers have heterogeneous lookup methods taking a key of an arbitrary type. All these methods also require to pass a hasher and/or a comparison function dealing with this key type. But what if the hasher/comparator embedded in the container itself can already deal with these key type? I'd like to avoid passing to these methods a function that the container already knows about.
Consider adding heterogeneous lookup methods using the hasher and/or comparator already stored in the container.
Like std::set or std::map, you might want to enable these methods only if the hasher and comparator declare a is_transparent
nested type. See http://en.cppreference.com/w/cpp/container/map/find.
Something like:
template <typename T, class... Options> class set { public: ... template <typename K, typename = key_compare::is_transparent> iterator find(const K& key) { return find(key, key_comp()); } ... };
That would make these heterogeneous lookup methods more convenient to use.
Ping? Any idea or progress on this topic?