We need to rethink remove in std.container
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Feb 22 05:14:20 PST 2011
On 2/21/11 11:27 PM, Jonathan M Davis wrote:
> The typical way to remove an element in the STL is to use find to find an element
> and then erase to remove it. remove in std.container is doing the same thing.
> The problem is that you can't give the result of find to remove, because instead
> of a single iterator, find gives you a whole range, and you probably don't want
> to remove that whole range. You generally either want to remove the first element
> or some set of elements at the front of the range.
This is the exact insight that made me recognize take() is an essential
range type.
Andrei
More information about the Digitalmars-d
mailing list