Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-07-19 20:48:05


From: "Giovanni Bajo" <giovannibajo_at_[hidden]>
>
> ----- Original Message -----
> From: "David Abrahams" <david.abrahams_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Saturday, July 20, 2002 3:01 AM
> Subject: Re: [boost] mpl::erase with vector_c
>
>
> > You might consider turning the way you think of vector around so that
> > push_front is actually what you're now calling push_back. You can still
> > index it in O(1) I think.
>
> Maybe my brain is swizzling, but I reckon it'd be better to force
> copy+push_back instead of copy_backward+push_front. It just looks to me
it
> makes more sense - copying going forward and adding to the end. Also,
isn't
> copy faster than copy_backward?

Not on type lists. Think of a type list as a singly-linked list.
copy_backward builds a sequence from back to front, which is just a matter
of tacking a new "node" on the front of an existing list.

We could reverse the sense of that and call the "front" "back" instead, but
then accessing the front element would be O(N)... which would be kinda
weird.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk