comparison.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_COMPARISON_HPP
  7. #define PHOENIX_OPERATOR_COMPARISON_HPP
  8. #include <boost/spirit/home/phoenix/core/composite.hpp>
  9. #include <boost/spirit/home/phoenix/core/compose.hpp>
  10. #include <boost/spirit/home/phoenix/detail/type_deduction.hpp>
  11. #include <boost/spirit/home/phoenix/operator/detail/unary_eval.hpp>
  12. #include <boost/spirit/home/phoenix/operator/detail/unary_compose.hpp>
  13. #include <boost/spirit/home/phoenix/operator/detail/binary_eval.hpp>
  14. #include <boost/spirit/home/phoenix/operator/detail/binary_compose.hpp>
  15. namespace boost { namespace phoenix
  16. {
  17. struct equal_to_eval;
  18. struct not_equal_to_eval;
  19. struct less_eval;
  20. struct less_equal_eval;
  21. struct greater_eval;
  22. struct greater_equal_eval;
  23. BOOST_BINARY_RESULT_OF(x == y, result_of_equal_to)
  24. BOOST_BINARY_RESULT_OF(x != y, result_of_not_equal_to)
  25. BOOST_BINARY_RESULT_OF(x < y, result_of_less)
  26. BOOST_BINARY_RESULT_OF(x <= y, result_of_less_equal)
  27. BOOST_BINARY_RESULT_OF(x > y, result_of_greater)
  28. BOOST_BINARY_RESULT_OF(x >= y, result_of_greater_equal)
  29. #define x a0.eval(env)
  30. #define y a1.eval(env)
  31. PHOENIX_BINARY_EVAL(equal_to_eval, result_of_equal_to, x == y)
  32. PHOENIX_BINARY_EVAL(not_equal_to_eval, result_of_not_equal_to, x != y)
  33. PHOENIX_BINARY_EVAL(less_eval, result_of_less, x < y)
  34. PHOENIX_BINARY_EVAL(less_equal_eval, result_of_less_equal, x <= y)
  35. PHOENIX_BINARY_EVAL(greater_eval, result_of_greater, x > y)
  36. PHOENIX_BINARY_EVAL(greater_equal_eval, result_of_greater_equal, x >= y)
  37. PHOENIX_BINARY_COMPOSE(equal_to_eval, ==)
  38. PHOENIX_BINARY_COMPOSE(not_equal_to_eval, !=)
  39. PHOENIX_BINARY_COMPOSE(less_eval, <)
  40. PHOENIX_BINARY_COMPOSE(less_equal_eval, <=)
  41. PHOENIX_BINARY_COMPOSE(greater_eval, >)
  42. PHOENIX_BINARY_COMPOSE(greater_equal_eval, >=)
  43. #undef x
  44. #undef y
  45. }}
  46. #endif