Re: appending/joining STL::deque/list containers in constant time
by Carter <cartercheng@[EMAIL PROTECTED]
>
May 14, 2008 at 02:37 PM
On May 14, 5:37 am, Jerry Coffin <jcof...@[EMAIL PROTECTED]
> wrote:
> In article <4bf0797c-e72f-4607-b0c1-8eaba4afcd44
> @[EMAIL PROTECTED]
>, carterch...@[EMAIL PROTECTED]
says...
>
> > This is probably somewhat of a beginners question but I am unfamiliar
> > with alot of aspects of C++. What is the correct way to append
> > multiple STL containers together in constant time. Obviously you can
> > do this with a linked list but is it possible to do the same thing
> > with the standard containers?
>
> If you're using std::list, you can use list::splice to do the job. I
> don't believe any of the other standard containers offers an equivalent.
>
> --
> Later,
> Jerry.
>
> The universe is a figment of its own imagination.
I will give this a try thanks. It seems to be an interesting
limitation that
for the std::deque you cannot do the same thing. In my cast a
std::list should do
the trick though. I understand the objection raised too- but it seems
a bit
unfortunate that given we have library of linked and doubly linked
lists that
you cannot perform shallow merging in cases where the containers being
merged from
are being discarded.
Regards,
Carter.