Re: [boost] Advanced find() for associative containers
On 03/16/2017 06:18 PM, Boris Rasin via Boost wrote:
2. Where exactly should it fit in the boost?
The most appropriate place would be Boost.Algorithm, so that is Marshall's domain.
Public interface consists of a single free function template:
template <typename C> auto find(C& c, const typename C::key_type& key);
Your find() function deviates on several accounts from std::find() so it should probably be renamed, e.g. to find_key. Can you elaborate on why you have a specialization that uses lower_bound()? What is the minimal C++ version required? Looks like C++14 from the auto return type.
Can you elaborate on why you have a specialization that uses lower_bound()?
This provides hint for insert/emplace in case element is not found. In fact this is the default implementation, and the find() member is only used for associative containers without lower_bound().
What is the minimal C++ version required? Looks like C++14 from the auto return type.
Yes, right now C++14 is required. It is probably possible to back port this code to C++11 and maybe even C++98.
participants (2)
-
Bjorn Reese
-
Boris Rasin