同样声明两种不同的类型

The*_* do 0 c++ metaprogramming

我希望能够做到这一点:

X<int> type_0;
X<int> type_1; 
Run Code Online (Sandbox Code Playgroud)

我希望type_0和type_1是两种不同的类型.我该怎么做?

Cas*_*Cow 7

template < typename T, int I > class X; 

X<int, __LINE__ > x0; 
X<int, __LINE__ > x1;
Run Code Online (Sandbox Code Playgroud)

x0和x1将是不同的类型,如果它们不在文件的同一行,则会像这样的任何其他声明.