TITLE: template function partial specialization partial ordering (Newsgroups: comp.lang.c++.moderated, 8 Apr 2000) DIMOV: Peter Dimov wrote: > > template void f(T); // #1: template function > > > > template<> void f(int*); // #2: explicit specialization of #1 > > > > template void f(T*); // #3: overloads #1 > > > > int* pi = 0; > > > > f(pi); // calls #3, NOT #2! #3 > #1, so the presence of #2 doesn't > > matter STEWART: Rob Stewart > If I understand correctly, only #1 and #3 are compared when > determine which to instantiate for this call. If #1 had been > selected, then #2 could be considered as a better fit of #1 for > this particular call, right? DIMOV: "Peter Dimov" Right. Actually the real story is that #1 would have to be instantiated for T=int* and the compiler would have noticed that the work is already done, but the end result is effectively the same: #2 is a better fit than #1. _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com