language: C++ 4.7.2 (gcc-4.7.2)
date: 732 days 3 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
 
using namespace std;
 
template<typename T>
struct X
{
   template<typename U, size_t N = sizeof(U)>
   struct Value { enum { val = 0 }; };
 
   template<typename U>
   struct Value<U, sizeof(int)> { enum { val = 1 }; };
   
   enum { value = Value<T>::val  };
};
 
int main() {
        cout << X<int>::value << endl;
        cout << X<char>::value << endl;
        return 0;
}