Let's do front, back, popFront, and popBack!

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 29 19:02:07 PST 2009


Steven Schveighoffer wrote:
> Will popFront and popBack return the element removed?  Usually that is the 
> meaning of pop (but not always).

Great question. In STL they can't because C++ couldn't move values 
reliably at the time (C++0X still can't IMHO but that's another 
discussion). D would be able to because it has good support for moving. 
I just don't want inefficiencies; returning e.g. a large struct will 
still involve some memcpying even if costly resources are not duplicated.

So I'm ambivalent about this.


Andrei



More information about the Digitalmars-d mailing list