Boost logo

Boost :

Subject: Re: [boost] [Root Pointer] New Documentation
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-04-11 00:25:18


On 11/04/2016 16:08, Phil Bouchard wrote:
>> Still, if you insist... How about:
>>
>> struct sort
>> {
>> bool operator(T const& p1, T const& p2) { return &p1 < &p2; }
>> }
>>
>> std::set<T, sort> all_;
>>
>> Now "remove" won't need to do linear search.
>
> It's still O(log(n)) whereas note_ptr is O(1).

Unless I'm missing something, node_ptr doesn't implement a remove
operation at all. You just discard the node_ptr when you aren't
interested in it any more, and memory isn't released until the root_ptr is.

That seems equivalent to Vladimir's code with the remove method omitted.

As I've said before, it's basically an arena allocator, just with
reference-counted arenas.


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