[svn] r5848: nemerle/trunk/lib/heap.n

nazgul svnadmin at nemerle.org
Tue Oct 25 21:48:17 CEST 2005


Log:
Use strongly typed IComparable in Heap

Author: nazgul
Date: Tue Oct 25 21:48:15 2005
New Revision: 5848

Modified:
   nemerle/trunk/lib/heap.n

Modified: nemerle/trunk/lib/heap.n
==============================================================================
--- nemerle/trunk/lib/heap.n	(original)
+++ nemerle/trunk/lib/heap.n	Tue Oct 25 21:48:15 2005
@@ -40,7 +40,7 @@
   /**
    * General usage heap, can be used as priority queue.
    */
-  public class Heap ['a] where 'a : System.IComparable 
+  public class Heap ['a] where 'a : System.IComparable ['a]
   {
     /* -- PUBLIC CONSTRUCTORS ----------------------------------------------- */
     
@@ -171,7 +171,7 @@
      * Creates new heap of elements of type 'b. New heap is totally independent, i.e.
      * any changes in original heap do not influence the second one and vice versa.
      */
-    public Map ['b] (f : 'a -> 'b) : Heap ['b] where 'b : System.IComparable 
+    public Map ['b] (f : 'a -> 'b) : Heap ['b] where 'b : System.IComparable ['b] 
     {
       def newHeapArray = array (m_heap.Length + 1);
       
@@ -265,8 +265,7 @@
      * Repairs the heap structure starting from element at index i, moving down.
      * For explanations see Cormen, Leiserson, Rivest "Introduction to algorithms".
      */
-    private heapify ['a] (i : int) : void
-    where 'a : System.IComparable
+    private heapify (i : int) : void
     {
       def l = left (i);
       def r = right (i);



More information about the svn mailing list