Nie mogę zrozumieć, dlaczego stwierdzenie w głównej jest dwuznaczne.Częściowa niejednoznaczność dotycząca specjalizacji szablonów
template<class T, class U, int I> struct X
{ void f() { cout << "Primary template" << endl; } };
template<class T, int I> struct X<T, T*, I>
{void f() { cout << "Partial specialization 1" << endl;}};
template<class T, class U, int I> struct X<T*, U, I>
{void f() { cout << "Partial specialization 2" << endl;}};
template<class T> struct X<int, T*, 10>
{void f() { cout << "Partial specialization 3" << endl;}};
template<class T, class U, int I> struct X<T, U*, I>
{void f() { cout << "Partial specialization 4" << endl;}};
int main()
{
X<int, int*, 10> f;
}
nie Czy X<int, T*, 10>
najbardziej wyspecjalizowany szablon? To jest przykład z http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fpartial_specialization.htm
Poniżej podano przykład: Kompilator nie zezwala na deklarację 'X' f ponieważ może dopasować szablon struct 'X ', szablon struct 'X ' lub szablon struct 'X ', a żadna z tych deklaracji nie jest lepsza od innych. –