C++ Logo

std-discussion

Advanced search

Re: Adding a new modification of algorithm std::unique

From: Vladimir Grigoriev <vlad.moscow_at_[hidden]>
Date: Sun, 14 Jan 2024 14:57:02 +0300
I think that the name of the algorithm should contain the word «partition». Something like partition_by_unique. Of course the algorithm also must be defined with a binary predicate.
 
I have one more problem with algorithm names. Early I suggested an algorithm that checks that a sequence is a strictly sorted that is that there is no equal elements in a sorted sequence. The standard algorithm std::is_sorted or std::is_sorted_until is unable to perform such a check. Could such an algorithm be named like is_strictly_sorted or a better name can be proposed?
 
With best regards
(Vlad from Moscow)
 
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
 
 
>Пятница, 12 января 2024, 21:21 +03:00 от Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>:
>
>On 12/01/2024 19:03, Vladimir Grigoriev wrote:
>> I am sure that it is a drawback of the library of
>> the standard algorithms. What alternative can you suggest?
>I wouldn't call it a "drawback"; it's a *design* of the std::unique
>algorithm. You're proposing a variation of it that doesn't eliminate the
>equivalent elements in each run, it just moves them. That's completely
>fine to propose if you have a use case for it! Just find a good name for
>this variation (which is really the only thing I've been questioning),
>properly define the semantics of what happens with the elements after
>the first of each run, and create a suitable proposal.
>
>My 2 c,
>--
>Giuseppe D'Angelo
>
 

Received on 2024-01-14 11:57:27