Boost logo

Boost :

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


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.

-Dave

----- Original Message -----
From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>

> It is a problem. Actually, you can, using 'insert', but it would be
> inefficient on one or another type of sequence. An interesting thing is
that
> we have the same situation in STL (there is no unified efficient way to
> insert something into container), but it's not a problem there because
most
> of STL algorithms work "in place" by modifying the sequence elements, and
in
> compile-time world we need to put the results somewhere else - i.e. push
> into a new sequence. Anyway, I guess a right solution for this is to
declare
> one of the sequence insert operations mandatory for any Extensible
Sequence;
> 'push_front' seems to be the only reasonable candidate for this, since
it's
> implementable for pretty much everything. I'll think a little bit more
about
> it, but if you need a uniform way to copy a sequence right away :),
consider
> 'copy_backward' + 'push_front' to be it.
>
> Thank you for your comments,
> Aleksey
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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