Debian Codegraph @

yo/advancedtemplates/examples/erase.cc

raw
1 #include <iostream>
2 #include <typeinfo>
3
4 #include "erase.h"
5 #include "typeat.h"
6
7 using namespace std;
8
9 int main()
10 {
11 //ERASE
12 cout <<
13 Erase<int, TypeList<char, double, int>>::List::size << '\n' <<
14 Erase<char, TypeList<int>>::List::size << '\n' <<
15 Erase<int, TypeList<int>>::List::size << '\n' <<
16 Erase<int, TypeList<>>::List::size << "\n";
17
18 //=
19
20 //ERASEIDX
21 if
22 (
23 typeid(TypeAt<2,
24 EraseIdx<1,
25 TypeList<int, char, size_t, double, int>>::List
26 >::Type
27 )
28 == typeid(double)
29 )
30 cout << "the third type is now a double\n";
31 //=
32
33 //ERASEALL
34 cout <<
35 "After erasing size_t from "
36 "TypeList<char, int, size_t, double, size_t>\n"
37 "it contains " <<
38 EraseAll<size_t,
39 TypeList<char, int, size_t, double, size_t>
40 >::List::size << " types\n";
41 //=
42
43 //ERASEDUP
44 cout <<
45 "After erasing duplicates from "
46 "TypeList<double, char, int, size_t, int, double, size_t>\n"
47 "it contains " <<
48 EraseDup<
49 TypeList<double, char, int, size_t, int, double, size_t>
50 >::List::size << " types\n";
51 //=
52
53 }