Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
typelist-test.cpp
Go to the documentation of this file.
1/*
2 TypeList(Test) - check the typelist metaprogramming facility
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
19#include "lib/test/run.hpp"
20#include "lib/meta/typelist.hpp"
21
22#include <iostream>
23
24using std::cout;
25using std::endl;
26
27
28namespace lib {
29namespace meta {
30namespace test {
31
32 template<int I>
33 struct Block
34 {
35 Block() { cout << "- "<<I<<" -"; }
36 };
37 struct Ending
38 {
39 Ending(){ cout << "- The End -" <<endl; }
40 };
41
42
44 , Block<13>
45 , Block<8>
46 , Block<5>
47 , Block<3>
48 , Block<2>
49 , Block<1>
50 >;
51 using ListOfTypes = SequenceOfTypes::List;
52
53
54 template<class X, class P>
55 class Chain
56 : X, P
57 { }
58 ;
59 template<class H, class T, class P>
60 class Chain<Node<H,T>, P>
61 : H, Chain<T,P>
62 { }
63 ;
64
66
67
68 /*********************************************************************/
74 class TypeList_test : public Test
75 {
76 void
77 run (Arg)
78 {
80
81 CHECK (1 == sizeof(me_haz_numbers));
82 }
83 };
84
85
87 LAUNCHER (TypeList_test, "unit common");
88
89
90
91}}} // namespace lib::meta::test
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition p.hpp:77
SequenceOfTypes::List ListOfTypes
Types< Block< 21 >, Block< 13 >, Block< 8 >, Block< 5 >, Block< 3 >, Block< 2 >, Block< 1 > > SequenceOfTypes
Chain< ListOfTypes, Ending > AssembledClass
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
Type list with head and tail; T ≡ Nil marks list end.
Definition typelist.hpp:90
Implementation namespace for support and library code.
Test runner and basic definitions for tests.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
A template metaprogramming technique for manipulating collections of types.