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