www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why does std.container.BinaryHeap use RefCounted?

implements a binary heap on top of a) a given random access range 
or b) another container that supports random access.

Regardless of it's underlying data structure type, it wraps its 
store in RefCounted, but I don't see why this is necessary.

In case b) the container itself uses reference counting, so 
holding a simple reference to a container should be enough.

In case a) the given range might use ref counting under the hood, 
see b). Or not, than it is probably relying on the GC, and no 
reference count is needed.
Dec 09 2014