/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman 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 PHOENIX_CORE_ARGUMENT_HPP #define PHOENIX_CORE_ARGUMENT_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #define PHOENIX_DECLARE_ARG(z, n, data) \ typedef actor > \ BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); \ actor > const \ BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument(); \ typedef actor > \ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \ actor > const \ BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument(); namespace boost { namespace phoenix { namespace detail { template struct error_argument_not_found {}; inline void test_invalid_argument(int) {} } template struct argument { typedef mpl::true_ no_nullary; template struct result { typedef typename fusion::result_of::at >::type type; }; template typename result::type eval(Env const& env) const { typedef typename mpl::if_< mpl::less, mpl::size > , int , detail::error_argument_not_found > >::type check_out_of_bounds; detail::test_invalid_argument(check_out_of_bounds()); return fusion::at_c(env.args()); } }; namespace arg_names { // Phoenix style names typedef actor > arg1_type; actor > const arg1 = argument<0>(); typedef actor > arg2_type; actor > const arg2 = argument<1>(); typedef actor > arg3_type; actor > const arg3 = argument<2>(); // BLL style names typedef actor > _1_type; actor > const _1 = argument<0>(); typedef actor > _2_type; actor > const _2 = argument<1>(); typedef actor > _3_type; actor > const _3 = argument<2>(); // Bring in the rest or the Phoenix style arguments (arg4 .. argN+1) // and BLL style arguments (_4 .. _N+1), using PP BOOST_PP_REPEAT_FROM_TO( 3, PHOENIX_ARG_LIMIT, PHOENIX_DECLARE_ARG, _) } }} #undef PHOENIX_DECLARE_ARG #endif