Lumiera  0.pre.03
»edit your freedom«
typelist-test.cpp
Go to the documentation of this file.
1 /*
2  TypeList(Test) - check the typelist metaprogramming facility
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
29 #include "lib/meta/typelist.hpp"
30 
31 #include <iostream>
32 
33 using std::string;
34 using std::cout;
35 
36 
37 namespace lib {
38 namespace meta {
39 namespace test {
40 
41  template<int I>
42  struct Block
43  {
44  Block() { cout << "- "<<I<<" -"; }
45  };
46  struct Zero
47  {
48  Zero() { cout << "- The End -"; }
49  };
50 
51 
52  typedef Types< Block<1>
53  , Block<2>
54  , Block<3>
55  , Block<5>
56  , Block<8>
57  , Block<13>
58  >::List TheList;
59 
60 
61  template<class X, class P>
62  class Chain
63  : X, P
64  { }
65  ;
66  template<class H, class T, class P>
67  class Chain<Node<H,T>, P>
68  : H, Chain<T,P>
69  { }
70  ;
71 
73 
74  /*********************************************************************/
80  class TypeList_test : public Test
81  {
82  void
83  run (Arg)
84  {
85  AssembledClass wow_me_haz_numbers;
86 
87  cout << "\n..Size of = "
88  << sizeof(wow_me_haz_numbers) <<"\n";
89  }
90  };
91 
92 
94  LAUNCHER (TypeList_test, "unit common");
95 
96 
97 
98 }}} // namespace lib::meta::test
A template metaprogramming technique for manipulating collections of types.
Definition: run.hpp:49
template for generating lots of different test types
Implementation namespace for support and library code.
Simple test class runner.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:80