fcall.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2001-2011 Joel de Guzman
  2. // Copyright (c) 2001-2011 Hartmut Kaiser
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_PP_IS_ITERATING
  7. #include <boost/preprocessor/iterate.hpp>
  8. #include <boost/preprocessor/repetition/enum_params.hpp>
  9. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  10. #define BOOST_PP_FILENAME_1 \
  11. <boost/spirit/home/karma/nonterminal/detail/fcall.hpp>
  12. #define BOOST_PP_ITERATION_LIMITS (1, SPIRIT_ARGUMENTS_LIMIT)
  13. #include BOOST_PP_ITERATE()
  14. ///////////////////////////////////////////////////////////////////////////////
  15. //
  16. // Preprocessor vertical repetition code
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #else // defined(BOOST_PP_IS_ITERATING)
  20. #define N BOOST_PP_ITERATION()
  21. template <BOOST_PP_ENUM_PARAMS(N, typename A)>
  22. typename lazy_enable_if_c<
  23. (params_size == N)
  24. , proto::terminal<
  25. spirit::karma::parameterized_nonterminal<
  26. parameterized_subject_type
  27. , fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> >
  28. >
  29. >::type
  30. operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& f)) const
  31. {
  32. typedef fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> vector_type;
  33. typedef spirit::karma::parameterized_nonterminal<
  34. parameterized_subject_type, vector_type> parameterized_type;
  35. typedef typename proto::terminal<parameterized_type>::type result_type;
  36. return result_type::make(
  37. parameterized_type(
  38. this->get_parameterized_subject()
  39. , fusion::make_vector(BOOST_PP_ENUM_PARAMS(N, f)))
  40. );
  41. }
  42. #undef N
  43. #endif // defined(BOOST_PP_IS_ITERATING)