C++ Logo

std-proposals

Advanced search

Heterogeneous erase for associative containers

From: Boyarinov, Konstantin <konstantin.boyarinov_at_[hidden]>
Date: Mon, 27 May 2019 15:19:39 +0000
Dear Sir or Madam,

We have a question regarding the heterogeneous methods in STL associative containers:
C++14 and C++17 introduced heterogeneous lookup functions (for std::map, std::unordered_map and others). These are overloads for find, count and other lookup algorithms, that accepts objects of any type compatible with key_type and only participates in overload resolution if Compare::is_transparent is valid and denotes a type.

But there are no overloads for heterogeneous erase and extract.

Does it make sense to propose adding the following methods to the std::map, std::multimap, std::set, std::multiset, std::unordered_map, std::unordered_multimap, std::unordered_set and std::unordered_multiset?

template <typename K>
size_type erase(const K& x);

template <typename K>
node_type extract(const K& x);

Best regards,
Konstantin Boyarinov


--------------------------------------------------------------------
Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Received on 2019-05-27 10:21:26