/Src/Dependencies/Boost/boost/spirit/home/phoenix/object/construct.hpp

http://hadesmem.googlecode.com/ · C++ Header · 80 lines · 61 code · 11 blank · 8 comment · 0 complexity · 3ef54429b97003560d30148c0a2af2dc 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. #ifndef PHOENIX_OBJECT_CONSTRUCT_HPP
  7. #define PHOENIX_OBJECT_CONSTRUCT_HPP
  8. #include <boost/spirit/home/phoenix/core/compose.hpp>
  9. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  10. namespace boost { namespace phoenix
  11. {
  12. namespace detail
  13. {
  14. template <typename T>
  15. struct construct_eval
  16. {
  17. template <typename Env,
  18. BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
  19. PHOENIX_COMPOSITE_LIMIT, typename T, fusion::void_)>
  20. struct result
  21. {
  22. typedef T type;
  23. };
  24. template <typename RT, typename Env>
  25. static RT
  26. eval(Env const& env)
  27. {
  28. return RT();
  29. }
  30. template <typename RT, typename Env, typename A0>
  31. static RT
  32. eval(Env const& env, A0& _0)
  33. {
  34. return RT(_0.eval(env));
  35. }
  36. template <typename RT
  37. , typename Env, typename A0, typename A1>
  38. static RT
  39. eval(Env const& env, A0& _0, A1& _1)
  40. {
  41. return RT(_0.eval(env), _1.eval(env));
  42. }
  43. // Bring in the rest of the evals
  44. #include <boost/spirit/home/phoenix/object/detail/construct_eval.hpp>
  45. };
  46. }
  47. template <typename T>
  48. inline actor<typename as_composite<detail::construct_eval<T> >::type>
  49. construct()
  50. {
  51. return compose<detail::construct_eval<T> >();
  52. }
  53. template <typename T, typename A0>
  54. inline actor<typename as_composite<detail::construct_eval<T>, A0>::type>
  55. construct(A0 const& _0)
  56. {
  57. return compose<detail::construct_eval<T> >(_0);
  58. }
  59. template <typename T, typename A0, typename A1>
  60. inline actor<typename as_composite<detail::construct_eval<T>, A0, A1>::type>
  61. construct(A0 const& _0, A1 const& _1)
  62. {
  63. return compose<detail::construct_eval<T> >(_0, _1);
  64. }
  65. // Bring in the rest of the new_ functions
  66. #include <boost/spirit/home/phoenix/object/detail/construct.hpp>
  67. }}
  68. #endif