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