Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/functional/adapter/unfused.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2006-2007 Tobias Schwinger | |
3 | |
4 Use modification and distribution are subject to the Boost Software | |
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
6 http://www.boost.org/LICENSE_1_0.txt). | |
7 ==============================================================================*/ | |
8 | |
9 #if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED) | |
10 #if !defined(BOOST_PP_IS_ITERATING) | |
11 | |
12 #include <boost/preprocessor/cat.hpp> | |
13 #include <boost/preprocessor/iteration/iterate.hpp> | |
14 #include <boost/preprocessor/repetition/enum_params.hpp> | |
15 #include <boost/preprocessor/repetition/enum_binary_params.hpp> | |
16 #include <boost/preprocessor/facilities/intercept.hpp> | |
17 | |
18 #include <boost/utility/result_of.hpp> | |
19 | |
20 #include <boost/config.hpp> | |
21 | |
22 #include <boost/fusion/container/vector/vector.hpp> | |
23 | |
24 #include <boost/fusion/functional/adapter/limits.hpp> | |
25 #include <boost/fusion/functional/adapter/detail/access.hpp> | |
26 | |
27 #if defined (BOOST_MSVC) | |
28 # pragma warning(push) | |
29 # pragma warning (disable: 4512) // assignment operator could not be generated. | |
30 #endif | |
31 | |
32 namespace boost { namespace fusion | |
33 { | |
34 template <class Function, bool AllowNullary = true> | |
35 class unfused; | |
36 | |
37 //----- ---- --- -- - - - - | |
38 | |
39 template <class Function> | |
40 class unfused<Function,true> | |
41 : public unfused<Function,false> | |
42 { | |
43 typedef typename detail::qf_c<Function>::type function_c; | |
44 typedef typename detail::qf<Function>::type function; | |
45 typedef typename detail::call_param<Function>::type func_const_fwd_t; | |
46 public: | |
47 | |
48 using unfused<Function,false>::operator(); | |
49 | |
50 inline explicit unfused(func_const_fwd_t f = function()) | |
51 : unfused<Function,false>(f) | |
52 { } | |
53 | |
54 typedef typename boost::result_of< | |
55 function_c(fusion::vector0<> &) >::type call_const_0_result; | |
56 | |
57 inline call_const_0_result operator()() const | |
58 { | |
59 fusion::vector0<> arg; | |
60 return this->fnc_transformed(arg); | |
61 } | |
62 | |
63 typedef typename boost::result_of< | |
64 function(fusion::vector0<> &) >::type call_0_result; | |
65 | |
66 inline call_0_result operator()() | |
67 { | |
68 fusion::vector0<> arg; | |
69 return this->fnc_transformed(arg); | |
70 } | |
71 }; | |
72 | |
73 template <class Function> class unfused<Function,false> | |
74 { | |
75 protected: | |
76 Function fnc_transformed; | |
77 typedef typename detail::qf_c<Function>::type function_c; | |
78 typedef typename detail::qf<Function>::type function; | |
79 typedef typename detail::call_param<Function>::type func_const_fwd_t; | |
80 public: | |
81 | |
82 inline explicit unfused(func_const_fwd_t f = function()) | |
83 : fnc_transformed(f) | |
84 { } | |
85 | |
86 template <typename Sig> | |
87 struct result; | |
88 | |
89 #define BOOST_PP_FILENAME_1 \ | |
90 <boost/fusion/functional/adapter/unfused.hpp> | |
91 #define BOOST_PP_ITERATION_LIMITS \ | |
92 (1,BOOST_FUSION_UNFUSED_MAX_ARITY) | |
93 #include BOOST_PP_ITERATE() | |
94 }; | |
95 }} | |
96 | |
97 #if defined (BOOST_MSVC) | |
98 # pragma warning(pop) | |
99 #endif | |
100 | |
101 namespace boost | |
102 { | |
103 #if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_DECLTYPE) | |
104 template<class F> | |
105 struct result_of< boost::fusion::unfused<F> const () > | |
106 { | |
107 typedef typename boost::fusion::unfused<F>::call_const_0_result type; | |
108 }; | |
109 template<class F> | |
110 struct result_of< boost::fusion::unfused<F>() > | |
111 { | |
112 typedef typename boost::fusion::unfused<F>::call_0_result type; | |
113 }; | |
114 #endif | |
115 template<class F> | |
116 struct tr1_result_of< boost::fusion::unfused<F> const () > | |
117 { | |
118 typedef typename boost::fusion::unfused<F>::call_const_0_result type; | |
119 }; | |
120 template<class F> | |
121 struct tr1_result_of< boost::fusion::unfused<F>() > | |
122 { | |
123 typedef typename boost::fusion::unfused<F>::call_0_result type; | |
124 }; | |
125 } | |
126 | |
127 #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED | |
128 #else // defined(BOOST_PP_IS_ITERATING) | |
129 //////////////////////////////////////////////////////////////////////////////// | |
130 // | |
131 // Preprocessor vertical repetition code | |
132 // | |
133 //////////////////////////////////////////////////////////////////////////////// | |
134 #define N BOOST_PP_ITERATION() | |
135 | |
136 template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)> | |
137 struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) > | |
138 : boost::result_of< function_c( | |
139 BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, | |
140 typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )> | |
141 { }; | |
142 | |
143 template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)> | |
144 struct result< Self(BOOST_PP_ENUM_PARAMS(N,T)) > | |
145 : boost::result_of< function( | |
146 BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, | |
147 typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )> | |
148 { }; | |
149 | |
150 template <BOOST_PP_ENUM_PARAMS(N,typename T)> | |
151 inline typename boost::result_of<function_c(BOOST_PP_CAT(fusion::vector,N) | |
152 <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type | |
153 operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const | |
154 { | |
155 BOOST_PP_CAT(fusion::vector,N)< | |
156 BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) > | |
157 arg(BOOST_PP_ENUM_PARAMS(N,a)); | |
158 return this->fnc_transformed(arg); | |
159 } | |
160 | |
161 template <BOOST_PP_ENUM_PARAMS(N,typename T)> | |
162 inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N) | |
163 <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type | |
164 operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) | |
165 { | |
166 BOOST_PP_CAT(fusion::vector,N)< | |
167 BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) > | |
168 arg(BOOST_PP_ENUM_PARAMS(N,a)); | |
169 return this->fnc_transformed(arg); | |
170 } | |
171 #undef N | |
172 #endif // defined(BOOST_PP_IS_ITERATING) | |
173 #endif | |
174 |