diff options
author | Kevin Smith <git@kismith.co.uk> | 2013-01-12 18:41:34 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-01-13 10:36:26 (GMT) |
commit | f3bc816af1b0d61452de973963e453bf3b3f95a2 (patch) | |
tree | e895f8afa3580e6cff6f5ad2017d45bf147a17c2 /3rdParty/Boost/src/boost/phoenix/function/adapt_function.hpp | |
parent | 188fc285c6555eadd3c9d50ab8a94adcade78d89 (diff) | |
download | swift-f3bc816af1b0d61452de973963e453bf3b3f95a2.zip swift-f3bc816af1b0d61452de973963e453bf3b3f95a2.tar.bz2 |
Adding in the spirit Boost stuff
Change-Id: I4f127ce61667243b64081b0aa309028d5077045f
Diffstat (limited to '3rdParty/Boost/src/boost/phoenix/function/adapt_function.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/phoenix/function/adapt_function.hpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/phoenix/function/adapt_function.hpp b/3rdParty/Boost/src/boost/phoenix/function/adapt_function.hpp new file mode 100644 index 0000000..69e1136 --- /dev/null +++ b/3rdParty/Boost/src/boost/phoenix/function/adapt_function.hpp @@ -0,0 +1,99 @@ +/*============================================================================== + Copyright (c) 2005-2010 Joel de Guzman + Copyright (c) 2010 Thomas Heller + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#ifndef BOOST_PHOENIX_FUNCTION_ADAPT_FUNCTION_HPP +#define BOOST_PHOENIX_FUNCTION_ADAPT_FUNCTION_HPP + +#include <boost/phoenix/core/limits.hpp> +#include <boost/phoenix/core/detail/function_eval.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> + +#define BOOST_PHOENIX_ADAPT_FUNCTION_NULLARY(RESULT, NAME, FUNC) \ + namespace detail \ + { \ + struct BOOST_PP_CAT(NAME, _impl_nullary) \ + { \ + typedef RESULT result_type; \ + \ + result_type \ + operator()() const \ + { \ + return FUNC(); \ + } \ + }; \ + } \ + \ + boost::phoenix::detail::expression::function_eval< \ + detail:: BOOST_PP_CAT(NAME, _impl_nullary) \ + >::type const \ + inline NAME() \ + { \ + return boost::phoenix::detail::expression:: \ + function_eval<detail:: BOOST_PP_CAT(NAME, _impl_nullary)> \ + ::make(detail:: BOOST_PP_CAT(NAME, _impl_nullary)()); \ + } \ +/**/ + +#define BOOST_PHOENIX_ADAPT_FUNCTION(RESULT, NAME, FUNC, N) \ + namespace detail \ + { \ + struct BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N) \ + { \ + template <typename Sig> \ + struct result; \ + \ + template <typename This, BOOST_PHOENIX_typename_A(N)> \ + struct result<This(BOOST_PHOENIX_A(N))> \ + {typedef RESULT type;}; \ + \ + template <BOOST_PHOENIX_typename_A(N)> \ + RESULT \ + operator()(BOOST_PHOENIX_A_ref_a(N)) const \ + { \ + return FUNC(BOOST_PHOENIX_a(N)); \ + } \ + }; \ + } \ + \ + template <BOOST_PHOENIX_typename_A(N)> \ + typename \ + boost::phoenix::detail::expression::function_eval< \ + detail:: BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N) \ + , BOOST_PHOENIX_A(N)>::type const \ + inline NAME(BOOST_PHOENIX_A_const_ref_a(N)) \ + { \ + return boost::phoenix::detail::expression:: \ + function_eval< \ + detail:: BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N) \ + , BOOST_PHOENIX_A(N) \ + >::make( \ + detail:: BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N)() \ + , BOOST_PHOENIX_a(N) \ + ); \ + } \ +/**/ + +#define BOOST_PHOENIX_ADAPT_FUNCTION_VARARG(RESULT, NAME, FUNC) \ + BOOST_PHOENIX_ADAPT_FUNCTION_NULLARY(NAME, FUNC) \ + BOOST_PP_REPEAT_FROM_TO( \ + 1 \ + , BOOST_PHOENIX_LIMIT \ + , BOOST_PHOENIX_ADAPT_FUNCTION_VARARG_R \ + , (RESULT, NAME, FUNC) \ + ) \ +/**/ + +#define BOOST_PHOENIX_ADAPT_FUNCTION_VARARG_R(Z, N, D) \ + BOOST_PHOENIX_ADAPT_FUNCTION( \ + BOOST_PP_TUPLE_ELEM(3, 0, D) \ + , BOOST_PP_TUPLE_ELEM(3, 1, D) \ + , BOOST_PP_TUPLE_ELEM(3, 2, D) \ + , N \ + ) \ +/**/ + +#endif |