www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6959] New: std.container's BinaryHeap doesn't work with Array!(T)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6959

           Summary: std.container's BinaryHeap doesn't work with Array!(T)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: zetetyck gmail.com



The documentation of BinaryHeap in std.container says that:
"If Store is a range, the BinaryHeap cannot grow beyond the size of that range.
If Store is a container that supports insertBack, the BinaryHeap may grow by
adding elements to the container."

But the Array!(T) container, which does have a insertBack() method, can't be
used with a BinaryHeap, as the following code:

import std.container;
void main() {
  auto array = Array!(int)();
  auto heap  = heapify(array);
  //auto heap = BinaryHeap!(Array!(int))(array); // gives same error
}

Gives the following compilation error:
\phobos\std\container.d(2660): Error: this._store()[this._length()] is not an
lvalue

This happens to make growable BinaryHeaps impossible using only Phobos
containers.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 16 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6959


zetetyck gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 5998 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 16 2011