/Src/Dependencies/Boost/boost/spirit/home/phoenix/operator/detail/binary_eval.hpp

http://hadesmem.googlecode.com/ · C++ Header · 44 lines · 35 code · 3 blank · 6 comment · 0 complexity · 6086b8fab4268f83f97358989190b144 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_OPERATOR_DETAIL_BINARY_EVAL_HPP
  7. #define PHOENIX_OPERATOR_DETAIL_BINARY_EVAL_HPP
  8. #include <boost/mpl/or.hpp>
  9. #include <boost/mpl/eval_if.hpp>
  10. #include <boost/mpl/identity.hpp>
  11. #include <boost/type_traits/is_same.hpp>
  12. #include <boost/spirit/home/phoenix/core/compose.hpp>
  13. #define PHOENIX_BINARY_EVAL(eval_name, op_result, expr) \
  14. struct eval_name \
  15. { \
  16. template <typename Env, typename A0, typename A1> \
  17. struct result \
  18. { \
  19. typedef typename A0::template result<Env>::type x_type; \
  20. typedef typename A1::template result<Env>::type y_type; \
  21. \
  22. typedef typename \
  23. mpl::eval_if< \
  24. mpl::or_<is_actor<x_type>, is_actor<y_type> > \
  25. , re_curry<eval_name, x_type, y_type> \
  26. , op_result<x_type, y_type> \
  27. >::type \
  28. type; \
  29. }; \
  30. \
  31. template <typename RT, typename Env, typename A0, typename A1> \
  32. static RT \
  33. eval(Env const& env, A0& a0, A1& a1) \
  34. { \
  35. return expr; \
  36. } \
  37. };
  38. #undef x
  39. #undef y
  40. #endif