/Src/Dependencies/Boost/boost/spirit/home/phoenix/bind/detail/bind_function.hpp

http://hadesmem.googlecode.com/ · C++ Header · 53 lines · 33 code · 9 blank · 11 comment · 0 complexity · 2a123a698c94a12ff11b57fd92716ccc MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2007 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #if !defined(BOOST_PP_IS_ITERATING)
  7. #if !defined(PHOENIX_BIND_DETAIL_BIND_FUNCTION_HPP)
  8. #define PHOENIX_BIND_DETAIL_BIND_FUNCTION_HPP
  9. #include <boost/preprocessor/iterate.hpp>
  10. #include <boost/preprocessor/dec.hpp>
  11. #include <boost/preprocessor/repetition/enum_params.hpp>
  12. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  13. #define BOOST_PP_ITERATION_PARAMS_1 \
  14. (3, (3, BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT), \
  15. "boost/spirit/home/phoenix/bind/detail/bind_function.hpp"))
  16. #include BOOST_PP_ITERATE()
  17. #endif
  18. ///////////////////////////////////////////////////////////////////////////////
  19. //
  20. // Preprocessor vertical repetition code
  21. //
  22. ///////////////////////////////////////////////////////////////////////////////
  23. #else // defined(BOOST_PP_IS_ITERATING)
  24. #define N BOOST_PP_ITERATION()
  25. template <typename RT
  26. , BOOST_PP_ENUM_PARAMS(N, typename T)
  27. , BOOST_PP_ENUM_PARAMS(N, typename A)>
  28. inline actor<
  29. typename as_composite<
  30. detail::function_eval<N>
  31. , detail::function_ptr<N, RT, RT(*)(BOOST_PP_ENUM_PARAMS(N, T))>
  32. , BOOST_PP_ENUM_PARAMS(N, A)
  33. >::type>
  34. bind(RT(*f)(BOOST_PP_ENUM_PARAMS(N, T))
  35. , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& _))
  36. {
  37. typedef detail::function_ptr<
  38. N, RT, RT(*)(BOOST_PP_ENUM_PARAMS(N, T))> fp_type;
  39. return compose<detail::function_eval<N> >(
  40. fp_type(f), BOOST_PP_ENUM_PARAMS(N, _));
  41. }
  42. #undef N
  43. #endif // defined(BOOST_PP_IS_ITERATING)