Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
typelist.hpp
Go to the documentation of this file.
1/*
2 TYPELIST.hpp - typelist meta programming facilities
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====================================================================
13This code is heavily inspired by
14 The Loki Library (loki-lib/trunk/include/loki/Sequence.h)
15 Copyright (c) 2001 by Andrei Alexandrescu
16 Copyright (c) 2005 by Peter Kümmel
17 This Loki code accompanies the book:
18 Alexandrescu, Andrei. "Modern C++ Design: Generic Programming
19 and Design Patterns Applied".
20 Copyright (c) 2001. Addison-Wesley. ISBN 0201704315
21
22 Loki Copyright Notice:
23 Permission to use, copy, modify, distribute and sell this software for any
24 purpose is hereby granted without fee, provided that the above copyright
25 notice appear in all copies and that both that copyright notice and this
26 permission notice appear in supporting documentation.
27 The author makes no representations about the suitability of this software
28 for any purpose. It is provided "as is" without express or implied warranty.
29*/
30
31
71#ifndef LIB_META_TYPELIST_H
72#define LIB_META_TYPELIST_H
73
74
75
76
77namespace lib {
78namespace meta {
79
81 struct Nil
82 {
83 using List = Nil;
84 };
85
88 template<class H, class T>
89 struct Node
90 {
91 using List = Node;
92 using Head = H;
93 using Tail = T;
94 };
95
97
98
99
101 template<typename...TYPES>
102 struct Types;
103
104 template<typename T, typename...TS>
105 struct Types<T,TS...>
106 {
107 using List = Node<T, typename Types<TS...>::List>;
108 using Seq = Types;
109 };
110
111 template<>
112 struct Types<>
113 {
114 using List = Nil;
115 using Seq = Types<>;
116 };
117
118}} // namespace lib::meta
119#endif
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
Node< Nil, Nil > NilNode
Definition typelist.hpp:96
Node< T, typename Types< TS... >::List > List
Definition typelist.hpp:107
»Empty« mark
Definition typelist.hpp:82
Type list with head and tail; T ≡ Nil marks list end.
Definition typelist.hpp:90
variadic sequence of types
Definition typelist.hpp:102
Implementation namespace for support and library code.