1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
template <class T, int... Args> struct C {
T member;
bool argsAre_16_32() { return false; }
};
template <> struct C<int, 16> {
int member;
bool argsAre_16_32() { return false; }
};
template <> struct C<int, 16, 32> : C<int, 16> {
bool argsAre_16_32() { return true; }
};
template <class T, typename... Args> struct D {
T member;
bool argsAre_Int_bool() { return false; }
};
template <> struct D<int, int> {
int member;
bool argsAre_Int_bool() { return false; }
};
template <> struct D<int, int, bool> : D<int, int> {
bool argsAre_Int_bool() { return true; }
};
template <typename... Args> struct OnlyPack {};
template <typename T, typename... Args> struct EmptyPack {};
int main(int argc, char const *argv[]) {
EmptyPack<int> emptyPack;
OnlyPack<int, char, double, D<int, int, bool>> onlyPack;
C<int, 16, 32> myC;
C<int, 16> myLesserC;
myC.member = 64;
(void)C<int, 16, 32>().argsAre_16_32();
(void)C<int, 16>().argsAre_16_32();
(void)(myC.member != 64);
D<int, int, bool> myD;
D<int, int> myLesserD; // breakpoint here
myD.member = 64;
(void)D<int, int, bool>().argsAre_Int_bool();
(void)D<int, int>().argsAre_Int_bool();
return 0; // break here
}
|