11 Apr
2016
11 Apr
'16
5:32 a.m.
On 2016-04-11 14:25, 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
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.
Ouch. No offence to the author but that certainly seals it for me. Giving up resource management for anything serious and long-running sounds like a professional suicide.