On 2/20/15 4:26 PM, "Nordlöw" wrote:
What's the policy on using GC or not in std.container.* ?
- std.container.Array uses malloc for its allocation but
- RedBlackTree.allocate() returns a: new RBNode!Elem*
Is this because RBNode* should be reachable outside of RedBlackTree or
is this a todo?
RedBlackTree was ported from dcollections, which has an allocator hierarchy.
The code in dcollections looked like this originally:
https://github.com/schveiguy/dcollections/blob/master/dcollections/RBTree.d#L1244
return alloc.allocate();
where alloc is the allocator for the tree.
In answer to your question, RBNode should not be accessible direction
outside of RedBlackTree. But we don't have allocators inside of Phobos,
so I used the easiest thing I could for portability.
-Steve