hitz@csi.uottawa.ca (Martin Hitz) (06/26/91)
I have been looking for an example for the usefulness of the "strictly better match" rule in the context of overloading resolution. The ARM gives one on pages 314-315 (section 13.2), however, I am wondering if it was possible to rewrite it in a "class-free" manner. I came up with the following: int f(void*, void*); // =: 1 int f(const int*, int*); // =: 2 int f(int *, const int*); // =: 3 int i = f(0,0); The best match sets are {1,3} for the first, and {1,2} for the second argument. The intersection is {1} (unique), however, 1 is NOT a strictly better match than 2 (therefore, the call is illegal), because (comparing 1 to 2): 0 -> void* is considered equal to 0 -> const int* 0 -> void* is considered equal to 0 -> int* although 0 -> int* is considered BETTER to 0 -> const int* during the first step (computation of "best" match sets). I have two questions: 1) Is the example valid? if yes: 2a) Is the argumentation correct? if no: 2b) Is there a valid "class-free" example? Thank you! Martin Hitz@csi.uottawa.ca