On 10 Nov 2006 20:12:27 +0100, Gabriel Dos Reis <[EMAIL PROTECTED]> wrote:
"Doug Gregor" <[EMAIL PROTECTED]> writes: I don't see why you need to merge the types, as opposed to setting their canonical types.
I have union-find on the mind, so I'm using the terms interchangeably. Setting their canonical types to the same value merges the equivalence classes of types.
| For instance, say we have built the types T* and | U* before seeing that same-type constraint. Now, we also need | TYPE_CANONICAL (T*) == TYPE_CANONICAL (U*). | And TYPE_CANONICAL(LessThanComparable<T>) == | TYPE_CANONICAL(LessThanComparable<U>). | If you know about all of these other types that have been built from T | and U, you can use Nelson and Oppen's algorithm to update the | TYPE_CANONICAL information relatively quickly. If you don't have that | information... In a template definition, one has that information.
? Our same-type constraint says SameType<T, U>. We can easily set TYPE_CANONICAL for T and U. We also need to set the TYPE_CANONICAL fields of LessThanComparable<T> and LessThanComparable<U> to the same value. How do we get from 'T' to 'LessThanComparable<T>'? Cheers, Doug