| | | gast128@hotmail.com |  |
| Posted: Sat Aug 30, 2008 3:28 pm Post subject: remove_copy |  |
| |  | |
Dear all,
it may be a friday afternoon issue, but I was looking for a remove variant which removed elements from a vector, but not throwing them away in the first place, but keeping a copy so that I still could do things with the removed elements before actually destroy them.
So in the STL you have the 'remove(_if)' function which removes elements. However the 'remove_copy' does not remove elements form the original input! It has more the semantic of a 'copy_if_not' function (also implicitly pointed out by Austern, by implementing 'copy_if' in terms of 'remove_copy_if', see 12.6.4 of Generic Programming && STL).
Since the STL already exist for more than a decade, it must be my own mind which interprets the function name wrong. Or it is indeed a friday afternoon issue. Of course human language is multiple interpretable and English is not my native language, so the original c+ + committee members may be 'right' after all.
Above functionality is solvable btw by stable_partition as someone pointed out in CUJ.
-- [ See LINK for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |
|