tags:

views:

30

answers:

1

I'm using the Generics Collection library C5 (server down :-( ) and I have an IntervalHeap(T) and I need to Delete or Replace a T that is not the Max or Min. How do I get an IPriorityQueueHandle from my T? The C5 library source code shows that IPriorityQueueHandle(T) has no methods or properties to implement and the compiler thinks my implementation of IPriorityQueueHandle(T) for my T is acceptable. I try to use a T like this:

q.Replace(t, t);

and the C5 library throws an InvalidCastException because it cannot convert my T to a (Handle).

A: 

It looks I can get an IPriorityQueueHandle(t) when I call q.Add(ref t.handle, t) which I can stick into my own field (t.handle) and pull out when I later need to modify t's priority within q with q.Replace(t.handle, t).

Jared Updike