Ru-Brd |
Normally, template deduction attempts to find a substitution of the function template parameters that make the parameterized type P identical to type A . However, when this is not possible, the following differences are tolerable:
template<typename T> class B<T> { }; template<typename T> class D : B<T> { }; template<typename T> void f(B<T>*); void g(D<long> dl) { f(&dl); // deduction succeeds with T substituted with long } The relaxed matching requirements are considered only if an exact match was not possible. Even so, deduction succeeds only if exactly one substitution was found to fit the A type to the substituted P type with these added conversions. |
Ru-Brd |