[Issue 6066] New: std.container: BinaryHeap interface is broken.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 28 03:09:41 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6066

           Summary: std.container: BinaryHeap interface is broken.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2011-05-28 03:05:00 PDT ---
>From my code:

auto h=BinaryHeap!(typeof(s),"a.y<b.y")(s);

The two argument's order is reverse: the compiler can always infer the type but
hardly the comparison predicate.

That the "convenience function" heapify does not take an optional comparison
predicate does not make things any better.

Ideally, it should be possible to write:

auto h=heapify!"a.y<b.y"(s);

(As is consistent with Eg. sort.)

Therefore:
1. Ideally, the order of the two arguments for BinaryHeap should change.
2. heapify _really_ should take a comparison predicate as its first template
argument. This won't break code, because no sane D developer has explicitly
passed the type to heapify.

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


More information about the Digitalmars-d-bugs mailing list