Chris@16
|
1
|
Chris@16
|
2 #if !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
3
|
Chris@16
|
4 ///// header body
|
Chris@16
|
5
|
Chris@16
|
6 #ifndef BOOST_MPL_QUOTE_HPP_INCLUDED
|
Chris@16
|
7 #define BOOST_MPL_QUOTE_HPP_INCLUDED
|
Chris@16
|
8
|
Chris@16
|
9 // Copyright Aleksey Gurtovoy 2000-2008
|
Chris@16
|
10 //
|
Chris@16
|
11 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
12 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
14 //
|
Chris@16
|
15 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
16
|
Chris@101
|
17 // $Id$
|
Chris@101
|
18 // $Date$
|
Chris@101
|
19 // $Revision$
|
Chris@16
|
20
|
Chris@16
|
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
22 # include <boost/mpl/void.hpp>
|
Chris@16
|
23 # include <boost/mpl/aux_/has_type.hpp>
|
Chris@16
|
24 #endif
|
Chris@16
|
25
|
Chris@16
|
26 #include <boost/mpl/aux_/config/bcc.hpp>
|
Chris@16
|
27 #include <boost/mpl/aux_/config/ttp.hpp>
|
Chris@16
|
28
|
Chris@16
|
29 #if defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) \
|
Chris@16
|
30 && !defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS)
|
Chris@16
|
31 # define BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
|
Chris@16
|
32 #endif
|
Chris@16
|
33
|
Chris@16
|
34 #if !defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) \
|
Chris@16
|
35 && defined(BOOST_MPL_CFG_NO_HAS_XXX)
|
Chris@16
|
36 # define BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS
|
Chris@16
|
37 #endif
|
Chris@16
|
38
|
Chris@16
|
39 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
Chris@16
|
40
|
Chris@16
|
41 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
Chris@16
|
42 && !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
43
|
Chris@16
|
44 # define BOOST_MPL_PREPROCESSED_HEADER quote.hpp
|
Chris@16
|
45 # include <boost/mpl/aux_/include_preprocessed.hpp>
|
Chris@16
|
46
|
Chris@16
|
47 #else
|
Chris@16
|
48
|
Chris@16
|
49 # include <boost/mpl/limits/arity.hpp>
|
Chris@16
|
50 # include <boost/mpl/aux_/preprocessor/params.hpp>
|
Chris@16
|
51 # include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
52 # include <boost/mpl/aux_/config/workaround.hpp>
|
Chris@16
|
53
|
Chris@16
|
54 # include <boost/preprocessor/iterate.hpp>
|
Chris@16
|
55 # include <boost/preprocessor/cat.hpp>
|
Chris@16
|
56
|
Chris@16
|
57 #if !defined(BOOST_MPL_CFG_NO_QUOTE_TEMPLATE)
|
Chris@16
|
58
|
Chris@16
|
59 namespace boost { namespace mpl {
|
Chris@16
|
60
|
Chris@16
|
61 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
62
|
Chris@16
|
63 template< typename T, bool has_type_ >
|
Chris@16
|
64 struct quote_impl
|
Chris@16
|
65 // GCC has a problem with metafunction forwarding when T is a
|
Chris@16
|
66 // specialization of a template called 'type'.
|
Chris@16
|
67 # if BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4)) \
|
Chris@16
|
68 && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(0)) \
|
Chris@16
|
69 && BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, BOOST_TESTED_AT(2))
|
Chris@16
|
70 {
|
Chris@16
|
71 typedef typename T::type type;
|
Chris@16
|
72 };
|
Chris@16
|
73 # else
|
Chris@16
|
74 : T
|
Chris@16
|
75 {
|
Chris@16
|
76 };
|
Chris@16
|
77 # endif
|
Chris@16
|
78
|
Chris@16
|
79 template< typename T >
|
Chris@16
|
80 struct quote_impl<T,false>
|
Chris@16
|
81 {
|
Chris@16
|
82 typedef T type;
|
Chris@16
|
83 };
|
Chris@16
|
84
|
Chris@16
|
85 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
86
|
Chris@16
|
87 template< bool > struct quote_impl
|
Chris@16
|
88 {
|
Chris@16
|
89 template< typename T > struct result_
|
Chris@16
|
90 : T
|
Chris@16
|
91 {
|
Chris@16
|
92 };
|
Chris@16
|
93 };
|
Chris@16
|
94
|
Chris@16
|
95 template<> struct quote_impl<false>
|
Chris@16
|
96 {
|
Chris@16
|
97 template< typename T > struct result_
|
Chris@16
|
98 {
|
Chris@16
|
99 typedef T type;
|
Chris@16
|
100 };
|
Chris@16
|
101 };
|
Chris@16
|
102
|
Chris@16
|
103 #endif
|
Chris@16
|
104
|
Chris@16
|
105 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
106 (3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/quote.hpp>))
|
Chris@16
|
107 #include BOOST_PP_ITERATE()
|
Chris@16
|
108
|
Chris@16
|
109 }}
|
Chris@16
|
110
|
Chris@16
|
111 #endif // BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
|
Chris@16
|
112
|
Chris@16
|
113 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
Chris@16
|
114 #endif // BOOST_MPL_QUOTE_HPP_INCLUDED
|
Chris@16
|
115
|
Chris@16
|
116 ///// iteration
|
Chris@16
|
117
|
Chris@16
|
118 #else
|
Chris@16
|
119 #define i_ BOOST_PP_FRAME_ITERATION(1)
|
Chris@16
|
120
|
Chris@16
|
121 template<
|
Chris@16
|
122 template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
|
Chris@16
|
123 , typename Tag = void_
|
Chris@16
|
124 >
|
Chris@16
|
125 struct BOOST_PP_CAT(quote,i_)
|
Chris@16
|
126 {
|
Chris@16
|
127 template< BOOST_MPL_PP_PARAMS(i_, typename U) > struct apply
|
Chris@16
|
128 #if defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS)
|
Chris@16
|
129 {
|
Chris@16
|
130 typedef typename quote_impl<
|
Chris@16
|
131 F< BOOST_MPL_PP_PARAMS(i_, U) >
|
Chris@16
|
132 , aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value
|
Chris@16
|
133 >::type type;
|
Chris@16
|
134 };
|
Chris@16
|
135 #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
136 : quote_impl<
|
Chris@16
|
137 F< BOOST_MPL_PP_PARAMS(i_, U) >
|
Chris@16
|
138 , aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value
|
Chris@16
|
139 >
|
Chris@16
|
140 {
|
Chris@16
|
141 };
|
Chris@16
|
142 #else
|
Chris@16
|
143 : quote_impl< aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value >
|
Chris@16
|
144 ::template result_< F< BOOST_MPL_PP_PARAMS(i_, U) > >
|
Chris@16
|
145 {
|
Chris@16
|
146 };
|
Chris@16
|
147 #endif
|
Chris@16
|
148 };
|
Chris@16
|
149
|
Chris@16
|
150 #undef i_
|
Chris@16
|
151 #endif // BOOST_PP_IS_ITERATING
|