Den torsdag den 2. oktober 2014 14.20.12 UTC+2 skrev Victor Bazarov:
> On 10/2/2014 7:19 AM, peter koch wrote:
> > Den torsdag den 2. oktober 2014 06.13.17 UTC+2 skrev David Harmon:
> >> On Wed, 01 Oct 2014 19:44:18 -0400 in comp.lang.c++, Victor Bazarov
> >> <v.ba...@comcast.invalid> wrote,
> >>> You probably meant std::remove_if ...
> >>
> >> After you figure out how to make it work.
> >
> > Yes. This can be tricky. It requires that you read the
> > documentation. Actually, this is only partly sarcastic. You must be
> > aware that remove_if does not remove anything, so it might be a bad
> > name although I am pressed to find a better one.
>
> std::rearrange_if ? (I'm for that one)
That suggests that the algorithm preserves the elements of the vector - something aka partition.
> std::preerase_if ? (worse, yet suggestive)
Hmmm... better. Perhaps prepare_to_erase_if? Or arrange_for_erasure_if.
We just love long names. ;-)
>
> After all, all that algorithm does is to *mutate* the sequence in a way
> that makes it easier to trim/excise the specific elements.
No - it does not necesarrily mutate. What happens to the erasable elements is unspecified.
Come to think about it, I believe we should keep the name. If not for anything else then because it marks the beginning of a tradition which has continued with names like std::move and std::forward. Even if std::move moves nothing and std::forward does not forward, the names are clear enough that you esily understand what they do.
/Peter