[Issue 6515] Support for a basic BinaryHeap operation

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 14 17:29:55 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=6515

safety0ff.bugz <safety0ff.bugz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz at gmail.com

--- Comment #1 from safety0ff.bugz <safety0ff.bugz at gmail.com> ---
import std.container.binaryheap;
import std.container.array;
import std.random;
void main()
{
  BinaryHeap!(Array!uint) heap;
  uint n = uniform(100, 2000);
  foreach (_;0..n)
    heap.insert(uniform(0,uint.max));
}

I didn't get it to work with uint[], perhaps there's a bug.
It kept saying "Cannot grow a heap created over a range," but as you can see,
it should work with uint[] as the following static if should evaluate to true.

https://github.com/dlang/phobos/blob/master/std/container/binaryheap.d#L279

--


More information about the Digitalmars-d-bugs mailing list