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)
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 
24 using std::string;
25 using std::cout;
26 
27 
28 namespace lib {
29 namespace meta {
30 namespace test {
31 
32  template<int I>
33  struct Block
34  {
35  Block() { cout << "- "<<I<<" -"; }
36  };
37  struct Zero
38  {
39  Zero() { cout << "- The End -"; }
40  };
41 
42 
43  typedef Types< Block<1>
44  , Block<2>
45  , Block<3>
46  , Block<5>
47  , Block<8>
48  , Block<13>
49  >::List TheList;
50 
51 
52  template<class X, class P>
53  class Chain
54  : X, P
55  { }
56  ;
57  template<class H, class T, class P>
58  class Chain<Node<H,T>, P>
59  : H, Chain<T,P>
60  { }
61  ;
62 
64 
65  /*********************************************************************/
71  class TypeList_test : public Test
72  {
73  void
74  run (Arg)
75  {
76  AssembledClass wow_me_haz_numbers;
77 
78  cout << "\n..Size of = "
79  << sizeof(wow_me_haz_numbers) <<"\n";
80  }
81  };
82 
83 
85  LAUNCHER (TypeList_test, "unit common");
86 
87 
88 
89 }}} // namespace lib::meta::test
A template metaprogramming technique for manipulating collections of types.
Definition: run.hpp:40
template for generating lots of different test types
Implementation namespace for support and library code.
Simplistic test class runner.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71