|
Boost : |
Subject: Re: [boost] [Boost.Range] An issue with the documentation of 'remove_erase_if' algorithm
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2013-02-07 17:18:00
> > Hi,
> >
> > I think there's an issue with the documentation of 'remove_erase_if'
> > algorithm from Boost.Range library.
> >
> > It says:
> >
> > "remove_erase_if removes the elements x that satisfy pred(x) from the
> > container. This is in contrast to the erase algorithm which merely
> > rearranges elements."
> >
> > I believe it's not in contrast to the "erase" algorithm but rather the
> > "remove" algorithm.
> >
> >
> On this particular ocassion the documentation is correct. The std::erase
> algorithm does not remove elements. Hence the erase - remove idiom is
> frequently useful:
> http://en.wikipedia.org/wiki/Erase-remove_idiom
>
> I have then made this idiom available and directly supported in Boost.Range.
There is no such thing as std::erase. Only container member functions are
called erase, and those *do* actually erase elements, not just rearrange
them.
The std::remove algorithm, on the other hand, just rearranges elements.
Therefore, I think the OP's observation is correct.
Regards,
Nate
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk