3 // Copyright (C) 2005 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
30 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
32 // Permission to use, copy, modify, sell, and distribute this software
33 // is hereby granted without fee, provided that the above copyright
34 // notice appears in all copies, and that both that copyright notice and
35 // this permission notice appear in supporting documentation. None of
36 // the above authors, nor IBM Haifa Research Laboratories, make any
37 // representation about the suitability of this software for any
38 // purpose. It is provided "as is" without express or implied warranty.
42 * Contains typelist_chain definitions.
43 * Typelists are an idea by Andrei Alexandrescu.
50 #pragma warning(disable: 4503)
51 #endif // #ifdef _MSC_VER
53 #include <ext/pb_assoc/detail/type_utils.hpp>
64 template<typename Hd
, typename Tl
>
78 #define PB_ASSOC_TYPELIST_CHAIN1(X0) pb_assoc::detail::typelist_chain<X0, pb_assoc::detail::null_type>
79 #define PB_ASSOC_TYPELIST_CHAIN2(X0, X1) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN1(X1) >
80 #define PB_ASSOC_TYPELIST_CHAIN3(X0, X1, X2) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN2(X1, X2) >
81 #define PB_ASSOC_TYPELIST_CHAIN4(X0, X1, X2, X3) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN3(X1, X2, X3) >
82 #define PB_ASSOC_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN4(X1, X2, X3, X4) >
83 #define PB_ASSOC_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
84 #define PB_ASSOC_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
85 #define PB_ASSOC_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
86 #define PB_ASSOC_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
87 #define PB_ASSOC_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
88 #define PB_ASSOC_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
89 #define PB_ASSOC_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
90 #define PB_ASSOC_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
91 #define PB_ASSOC_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
92 #define PB_ASSOC_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
94 #include <ext/pb_assoc/detail/typelist/typelist_apply.hpp>
96 template<class Fn
, class Typelist
>
98 typelist_apply(Fn
& r_fn
, Typelist
/*tl*/)
102 typename
Typelist::root
>
108 #include <ext/pb_assoc/detail/typelist/typelist_append.hpp>
110 template<class Typelist0
, class Typelist1
>
111 struct typelist_append
115 typename
detail::typelist_append_
<
116 typename
Typelist0::root
,
117 typename
Typelist1::root
>::type
121 typedef typelist
< res_hd
> type
;
124 #include <ext/pb_assoc/detail/typelist/typelist_typelist_append.hpp>
126 template<class Typelist_Typelist
>
127 struct typelist_typelist_append
131 typename
detail::typelist_typelist_append_
<
132 typename
Typelist_Typelist::root
>::type
136 typedef typelist
< res_hd
> type
;
139 #include <ext/pb_assoc/detail/typelist/typelist_contains.hpp>
141 template<class Typelist
, class T
>
142 struct typelist_contains
147 detail::typelist_contains_
<
148 typename
Typelist::root
,
153 #include <ext/pb_assoc/detail/typelist/typelist_filter.hpp>
155 template<class Typelist
, template<typename T
>
157 struct typelist_filter
161 typename
detail::typelist_chain_filter_
<
162 typename
Typelist::root
,
167 typedef typelist
< root_type
> type
;
170 #include <ext/pb_assoc/detail/typelist/typelist_at_index.hpp>
172 template<class Typelist
, int i
>
173 struct typelist_at_index
176 typename
detail::typelist_chain_at_index_
<
177 typename
Typelist::root
,
182 #include <ext/pb_assoc/detail/typelist/typelist_transform.hpp>
184 template<class Typelist
, template<class T
>
186 struct typelist_transform
190 typename
detail::typelist_chain_transform_
<
191 typename
Typelist::root
,
196 typedef typelist
< root_type
> type
;
199 #undef PB_ASSOC_TYPELIST_CHAIN1
200 #undef PB_ASSOC_TYPELIST_CHAIN2
201 #undef PB_ASSOC_TYPELIST_CHAIN3
202 #undef PB_ASSOC_TYPELIST_CHAIN4
203 #undef PB_ASSOC_TYPELIST_CHAIN5
204 #undef PB_ASSOC_TYPELIST_CHAIN6
205 #undef PB_ASSOC_TYPELIST_CHAIN7
206 #undef PB_ASSOC_TYPELIST_CHAIN8
207 #undef PB_ASSOC_TYPELIST_CHAIN9
208 #undef PB_ASSOC_TYPELIST_CHAIN10
209 #undef PB_ASSOC_TYPELIST_CHAIN11
210 #undef PB_ASSOC_TYPELIST_CHAIN12
211 #undef PB_ASSOC_TYPELIST_CHAIN13
212 #undef PB_ASSOC_TYPELIST_CHAIN14
213 #undef PB_ASSOC_TYPELIST_CHAIN15
215 } // namespace detail
217 } // namespace pb_assoc
219 #endif // #ifndef TYPELIST_HPP