123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- /*==============================================================================
- Copyright (c) 2001-2010 Joel de Guzman
- Copyright (c) 2010 Eric Niebler
- Copyright (c) 2015 John Fletcher
- 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_FUNCTION_HPP
- #define BOOST_PHOENIX_FUNCTION_FUNCTION_HPP
- #include <boost/phoenix/config.hpp>
- #include <boost/phoenix/core/limits.hpp>
- #include <boost/phoenix/core/detail/function_eval.hpp>
- #include <boost/utility/result_of.hpp>
- namespace boost { namespace phoenix
- {
- /////////////////////////////////////////////////////////////////////////////
- // Functions
- /////////////////////////////////////////////////////////////////////////////
- namespace expression
- {
- #if defined(BOOST_PHOENIX_NO_VARIADIC_FUNCTION)
- template <typename F, BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_ACTOR_LIMIT)>
- struct function
- : detail::expression::function_eval<F, BOOST_PHOENIX_A(BOOST_PHOENIX_ACTOR_LIMIT)>
- {};
- #else
- // TODO:
- #endif
- }
- // functor which returns our lazy function call extension
- template<typename F>
- struct function
- {
- BOOST_CONSTEXPR function()
- : f()
- {}
- BOOST_CONSTEXPR function(F f_)
- : f(f_)
- {}
- template <typename Sig>
- struct result;
- #if defined(BOOST_PHOENIX_NO_VARIADIC_FUNCTION)
- typename detail::expression::function_eval<F>::type const
- operator()() const
- {
- return detail::expression::function_eval<F>::make(f);
- }
- // Bring in the rest
- #include <boost/phoenix/function/detail/cpp03/function_operator.hpp>
- // Solves the result problem for F(X)
- template <typename This, typename A0>
- struct result<This(A0)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type>
- {};
- // Solves the result problem for F(X,Y)
- template <typename This, typename A0, typename A1>
- struct result<This(A0,A1)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type,
- typename boost::remove_reference<A1>::type>
- {};
- // Solves the result problem for F(X,Y,Z)
- template <typename This, typename A0, typename A1, typename A2>
- struct result<This(A0,A1,A2)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type,
- typename boost::remove_reference<A1>::type,
- typename boost::remove_reference<A2>::type>
- {};
- // Solves the result problem for F(W,X,Y,Z)
- template <typename This, typename A0, typename A1,
- typename A2, typename A3>
- struct result<This(A0,A1,A2,A3)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type,
- typename boost::remove_reference<A1>::type,
- typename boost::remove_reference<A2>::type,
- typename boost::remove_reference<A3>::type>
- {};
- // Solves the result problem for F(V,W,X,Y,Z)
- template <typename This, typename A0, typename A1,
- typename A2, typename A3,typename A4>
- struct result<This(A0,A1,A2,A3,A4)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type,
- typename boost::remove_reference<A1>::type,
- typename boost::remove_reference<A2>::type,
- typename boost::remove_reference<A3>::type,
- typename boost::remove_reference<A4>::type>
- {};
- // Solves the result problem for F(U,V,W,X,Y,Z)
- template <typename This, typename A0, typename A1,
- typename A2, typename A3,typename A4,
- typename A5>
- struct result<This(A0,A1,A2,A3,A4,A5)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type,
- typename boost::remove_reference<A1>::type,
- typename boost::remove_reference<A2>::type,
- typename boost::remove_reference<A3>::type,
- typename boost::remove_reference<A4>::type,
- typename boost::remove_reference<A5>::type>
- {};
- // Solves the result problem for F(T,U,V,W,X,Y,Z)
- template <typename This, typename A0, typename A1,
- typename A2, typename A3,typename A4,
- typename A5, typename A6>
- struct result<This(A0,A1,A2,A3,A4,A5,A6)>
- : detail::expression::function_eval<F,
- typename boost::remove_reference<A0>::type,
- typename boost::remove_reference<A1>::type,
- typename boost::remove_reference<A2>::type,
- typename boost::remove_reference<A3>::type,
- typename boost::remove_reference<A4>::type,
- typename boost::remove_reference<A5>::type,
- typename boost::remove_reference<A6>::type>
- {};
- #else
- // TODO:
- #endif
- F f;
- };
- }
- template<typename F>
- struct result_of<phoenix::function<F>()>
- : phoenix::detail::expression::function_eval<F>
- {};
- }
- #endif
|