小编use*_*459的帖子

部分模板专业化模糊

我不明白为什么主要陈述含糊不清.

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 …
Run Code Online (Sandbox Code Playgroud)

c++ templates partial-specialization specialization template-specialization

13
推荐指数
1
解决办法
1768
查看次数