[Boost.Range] An issue with the documentation of 'remove_erase_if' algorithm

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. WBR, Adam Romanek

On Thu, Feb 7, 2013 at 7:15 AM, Adam Romanek <romanek.adam@gmail.com> wrote:
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.
WBR, Adam Romanek
Thanks, Neil Groves
______________________________**_________________ Unsubscribe & other changes: http://lists.boost.org/** mailman/listinfo.cgi/boost<http://lists.boost.org/mailman/listinfo.cgi/boost>

On 02/07/2013 11:39 AM, Neil Groves wrote:
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.
I know what std::erase, std::remove and the idiom are all about. The problem in the documentation is still there. Check the documentation of "remove_erase" algorithm. It says: "(...) This is in contrast to the *remove* algorithm which merely rearranges elements. (...)" On the other hand, the documentation of "remove_erase_if" algorithm says: "(...) This is in contrast to the *erase* algorithm which merely rearranges elements. (...)" Can you see the difference? WBR, Adam Romanek

On Thu, Feb 7, 2013 at 10:46 AM, Adam Romanek <romanek.adam@gmail.com>wrote:
On 02/07/2013 11:39 AM, Neil Groves wrote:
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<http://en.wikipedia.org/wiki/Erase-remove_idiom>
I have then made this idiom available and directly supported in Boost.Range.
I know what std::erase, std::remove and the idiom are all about. The problem in the documentation is still there.
Well it would be... I have only just been shown where the problem is ;-)
Check the documentation of "remove_erase" algorithm. It says:
"(...) This is in contrast to the *remove* algorithm which merely rearranges elements. (...)"
Thanks for this report it is true that this one is incorrect. This was not what your original email contained. You posted a snippet from the correct example. You also explicitly stated: "I believe it's not in contrast to the "erase" algorithm but rather the "remove" algorithm.". You didn't highlight that remove_erase_if was inconsistent to remove_erase. From what was presented the most likely explanation was that you had a fairly common mis-aprehension to many others about the std::erase algorithm. I'm delighted that this is not the case, but please don't take offence.
On the other hand, the documentation of "remove_erase_if" algorithm says:
"(...) This is in contrast to the *erase* algorithm which merely rearranges elements. (...)"
Can you see the difference?
I can see the defect now that the relevant section has been highlighted. I understand that you meant that the documentation for remove_erase is incorrect rather than remove_erase_if. I shall correct this for the next release.
WBR, Adam Romanek
Thanks for the report, Neil Groves

2013/2/7 Neil Groves <neil@grovescomputing.com>
On Thu, Feb 7, 2013 at 10:46 AM, Adam Romanek <romanek.adam@gmail.com
wrote:
Check the documentation of "remove_erase" algorithm. It says:
"(...) This is in contrast to the *remove* algorithm which merely rearranges elements. (...)"
On the other hand, the documentation of "remove_erase_if" algorithm says:
"(...) This is in contrast to the *erase* algorithm which merely rearranges elements. (...)"
Can you see the difference?
I can see the defect now that the relevant section has been highlighted. I understand that you meant that the documentation for remove_erase is incorrect rather than remove_erase_if. I shall correct this for the next release.
Hi, I think you got it the other way around: remove "merely rearranges elements", while erase -- deletes a specified range of iterators to nonexistence. So from the above quotes of the docs: remove_erase_if docs seem to be wrong. Regards, Kris

On 07.02.2013, at 16:48, Krzysztof Czainski wrote:
2013/2/7 Neil Groves <neil@grovescomputing.com>
On Thu, Feb 7, 2013 at 10:46 AM, Adam Romanek <romanek.adam@gmail.com
wrote:
Check the documentation of "remove_erase" algorithm. It says:
"(...) This is in contrast to the *remove* algorithm which merely rearranges elements. (...)"
On the other hand, the documentation of "remove_erase_if" algorithm says:
"(...) This is in contrast to the *erase* algorithm which merely rearranges elements. (...)"
Can you see the difference?
I can see the defect now that the relevant section has been highlighted. I understand that you meant that the documentation for remove_erase is incorrect rather than remove_erase_if. I shall correct this for the next release.
Hi,
I think you got it the other way around: remove "merely rearranges elements", while erase -- deletes a specified range of iterators to nonexistence.
So from the above quotes of the docs: remove_erase_if docs seem to be wrong.
Yes. std::remove and std::remove_if are the algorithms. erase is the member function that does the real deletion. When you fix remove_erase_if, make sure you reference remove_if, not remove. Sebastian

On 02/07/2013 04:38 PM, Neil Groves wrote:
Check the documentation of "remove_erase" algorithm. It says:
"(...) This is in contrast to the *remove* algorithm which merely rearranges elements. (...)"
Thanks for this report it is true that this one is incorrect. This was not what your original email contained. You posted a snippet from the correct example. You also explicitly stated: "I believe it's not in contrast to the "erase" algorithm but rather the "remove" algorithm.". You didn't highlight that remove_erase_if was inconsistent to remove_erase. From what was presented the most likely explanation was that you had a fairly common mis-aprehension to many others about the std::erase algorithm. I'm delighted that this is not the case, but please don't take offence.
Sorry for this misunderstanding. To me, my intent was clear, but it seems that the words were not chosen right.
On the other hand, the documentation of "remove_erase_if" algorithm says:
"(...) This is in contrast to the *erase* algorithm which merely rearranges elements. (...)"
Can you see the difference?
I can see the defect now that the relevant section has been highlighted. I understand that you meant that the documentation for remove_erase is incorrect rather than remove_erase_if. I shall correct this for the next release.
As others have already pointed out the problem lays in the documentation of 'remove_erase_if' algorithm.
WBR, Adam Romanek
Thanks for the report, Neil Groves
I'm glad I could help. WBR, Adam Romanek

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

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.
That is a very polite way to put it! The old age has finally caught up with me. I was completely wrong and asserting absolute nonsense earlier. I apologize to the OP and for promoting false information. I've given myself a pretty stiff talking to and will try not to let this happen again! I'll fix the documentation on or before this weekend.
Regards, Nate
Thanks for your patience, understanding and correction. Regards, Neil Groves
participants (5)
-
Adam Romanek
-
Krzysztof Czainski
-
Nathan Ridge
-
Neil Groves
-
Sebastian Redl