[[[My comments in bold]]]

вт, 11 февр. 2025 г. в 21:06, Bo Persson via Std-Proposals <std-proposals@lists.isocpp.org>:
On tis 2025-02-11 at 09:29, Александр Поваляев via Std-Proposals wrote:
> A Proposal to Add a New Multiset container Method to the Standard
> Library Technical Report
>

> C++ Containers library std::multiset
>
> (1) size_type reduce( const Key& key );
>
> (2)
> template< class K >
> size_type reduce( K&& x );
>
> (3) size_type reduce( const Key& key, size_type count );
>
> (4)
> template< class K >
> size_type reduce( K&& x, size_type count );
>
> This method acts in right the opposite way to how method 'insert' does.
> Method 'reduce' decreases the number of std::multiset elements with
> the same key value. And while being supplied within the second argument
> 'size_type count', method 'reduce' decreases the number of std::multiset
> elements with the same key value but several times.
>

How do we know if the function is to remove the oldest or the newest
inserts? Or some in the middle?
[[[Aleksandr]]] I believe it should be in the priority queue like style. 
https://en.cppreference.com/w/cpp/container/multiset says "

The order of the elements that compare equivalent is the order of insertion and does not change.

(since C++11)
", so the oldest inserts should be deleted.


--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals