| 1 |
#include <iostream> |
| 2 |
#include <typeinfo> |
| 3 |
|
| 4 |
#include "typeat.h" |
| 5 |
|
| 6 |
using namespace std; |
| 7 |
|
| 8 |
int main() |
| 9 |
{ |
| 10 |
//EXAMPLE |
| 11 |
using list3 = TypeList<int, char, bool>; |
| 12 |
|
| 13 |
// TypeAt<3, list3>::Type invalid; |
| 14 |
TypeAt<0, list3>::Type intVariable = 13; |
| 15 |
TypeAt<2, list3>::Type boolVariable = true; |
| 16 |
|
| 17 |
cout << "The size of the first type is " << |
| 18 |
sizeof(TypeAt<0, list3>::Type) << ", " |
| 19 |
"the size of the third type is " << |
| 20 |
sizeof(TypeAt<2, list3>::Type) << "\n"; |
| 21 |
|
| 22 |
if (typeid(TypeAt<1, list3>::Type) == typeid(char)) |
| 23 |
cout << "The typelist's 2nd type is char\n"; |
| 24 |
|
| 25 |
if (typeid(TypeAt<2, list3>::Type) != typeid(char)) |
| 26 |
cout << "The typelist's 3nd type is not char\n"; |
| 27 |
//= |
| 28 |
} |