less_equal.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*=============================================================================
  2. Copyright (c) 1999-2003 Jaakko Jarvi
  3. Copyright (c) 2001-2011 Joel de Guzman
  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. ==============================================================================*/
  7. #if !defined(FUSION_LESS_EQUAL_05052005_0432)
  8. #define FUSION_LESS_EQUAL_05052005_0432
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  11. #include <boost/fusion/sequence/intrinsic/end.hpp>
  12. #include <boost/fusion/sequence/intrinsic/size.hpp>
  13. #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
  14. #if defined(FUSION_DIRECT_OPERATOR_USAGE)
  15. #include <boost/fusion/sequence/comparison/detail/less_equal.hpp>
  16. #else
  17. #include <boost/fusion/sequence/comparison/less.hpp>
  18. #endif
  19. namespace boost { namespace fusion
  20. {
  21. template <typename Seq1, typename Seq2>
  22. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  23. inline bool
  24. less_equal(Seq1 const& a, Seq2 const& b)
  25. {
  26. #if defined(FUSION_DIRECT_OPERATOR_USAGE)
  27. return detail::sequence_less_equal<Seq1 const, Seq2 const>::
  28. call(fusion::begin(a), fusion::begin(b));
  29. #else
  30. return !(b < a);
  31. #endif
  32. }
  33. namespace operators
  34. {
  35. template <typename Seq1, typename Seq2>
  36. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  37. inline typename
  38. boost::enable_if<
  39. traits::enable_comparison<Seq1, Seq2>
  40. , bool
  41. >::type
  42. operator<=(Seq1 const& a, Seq2 const& b)
  43. {
  44. return fusion::less_equal(a, b);
  45. }
  46. }
  47. using operators::operator<=;
  48. }}
  49. #endif