equal
deleted
inserted
replaced
1 #include <iostream> |
1 #include <iostream> |
2 |
2 |
3 using namespace std; |
3 using namespace std; |
4 |
4 |
|
5 #include <lemon/utility.h> |
5 |
6 |
|
7 using namespace std; |
|
8 /* |
6 struct _EmptyList { |
9 struct _EmptyList { |
7 void write() const {} |
10 void write() const {} |
8 }; |
11 }; |
9 |
12 |
10 template <typename _Item, typename _Next> |
13 template <typename _Item, typename _Next> |
47 typedef _Writer<> Writer; |
50 typedef _Writer<> Writer; |
48 |
51 |
49 int main() { |
52 int main() { |
50 Writer().add(3).add("alpha").add(4.53).write(); |
53 Writer().add(3).add("alpha").add(4.53).write(); |
51 } |
54 } |
|
55 */ |
|
56 |
|
57 class A { |
|
58 public: |
|
59 typedef int X; |
|
60 }; |
|
61 |
|
62 class C { |
|
63 }; |
|
64 |
|
65 template <typename A> |
|
66 class TRUE { |
|
67 public: |
|
68 static const bool state = true; |
|
69 }; |
|
70 |
|
71 template <typename _A> |
|
72 class B { |
|
73 public: |
|
74 typedef enable_if<A::X, int> state; |
|
75 }; |
|
76 |
|
77 template <typename _A> |
|
78 class B<_A, void> { |
|
79 public: |
|
80 static const bool state = true; |
|
81 }; |
|
82 |
|
83 int main() { |
|
84 printf("%s\n", B<A>::state(), true ? "true" : "false"); |
|
85 printf("%s\n", B<C>::state(), true ? "true" : "false"); |
|
86 return 0; |
|
87 } |