Boost logo

Boost Users :

Subject: Re: [Boost-users] [Intrusive] List Manipulation and Management
From: Stefan Strasser (strasser_at_[hidden])
Date: 2009-09-26 18:49:18


Am Saturday 26 September 2009 20:18:58 schrieb Freddie Witherden:
>
> Node* afunction(...);
> [...]
> Node* tail;
> link(tail, afunction(...));
>
> This is rather nice as in O(1) you can append a returned list to your
> current list. However, I am unsure how I would accomplish this in
> Boost Intrusive.

list.splice(list.end(),otherlist);

boost.intrusive represents the nodes as STL-like containers, if you need to
port code that handles nodes directly you might be interested in
*list_algorithms of boost.intrusive, but I'd recommend using the containers.

>
> Secondly, when dealing with heap allocated items, which need to be
> deleted, the current code uses a while loop to call each nodes
> destructor. What is the intrusive equivalent?

clear_and_dispose()


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net