|
Boost : |
Subject: Re: [boost] [Root Pointer] New Documentation
From: Phil Bouchard (philippeb8_at_[hidden])
Date: 2016-04-11 00:35:24
On 04/11/2016 12:25 AM, Gavin Lambert wrote:
> 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.
Actually the node_ptr memory will be release right off the bat, before
the root_ptr is destroyed, if it is not cyclic.
> 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.
>
>
>
> _______________________________________________
> 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