template43.c

来自「linux下的gcc编译器」· C语言 代码 · 共 31 行

C
31
字号
// Test matching of partial specializations.template <int* x, int* y>class EQUAL {public:	enum { value = 0 };};template <int* x>class EQUAL<x,x> {public:	enum { value = 1 };};int x;int y;int equals_x_x = EQUAL<&x,&x>::value; // expected value: 1int equals_x_y = EQUAL<&x,&y>::value; // expected value: 0int equals_y_x = EQUAL<&y,&x>::value; // expected value: 0int equals_y_y = EQUAL<&y,&y>::value; // expected value: 1int main (){  if (equals_x_x == 1      && equals_x_y == 0      && equals_y_x == 0      && equals_y_y == 1)    return 0;  return 1;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?