less.hpp 1.8 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_05052005_1141)
  8. #define FUSION_LESS_05052005_1141
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/mpl/bool.hpp>
  11. #include <boost/fusion/iterator/deref.hpp>
  12. #include <boost/fusion/iterator/next.hpp>
  13. #include <boost/fusion/iterator/equal_to.hpp>
  14. #include <boost/fusion/support/as_const.hpp>
  15. namespace boost { namespace fusion { namespace detail
  16. {
  17. template <typename Seq1, typename Seq2>
  18. struct sequence_less
  19. {
  20. typedef typename result_of::end<Seq1>::type end1_type;
  21. typedef typename result_of::end<Seq2>::type end2_type;
  22. template <typename I1, typename I2>
  23. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  24. static bool
  25. call(I1 const&, I2 const&, mpl::true_)
  26. {
  27. return false;
  28. }
  29. template <typename I1, typename I2>
  30. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  31. static bool
  32. call(I1 const& a, I2 const& b, mpl::false_)
  33. {
  34. return extension::as_const(*a) < extension::as_const(*b) ||
  35. (!(extension::as_const(*b) < extension::as_const(*a)) &&
  36. call(fusion::next(a), fusion::next(b)));
  37. }
  38. template <typename I1, typename I2>
  39. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  40. static bool
  41. call(I1 const& a, I2 const& b)
  42. {
  43. typename result_of::equal_to<I1, end1_type>::type eq;
  44. return call(a, b, eq);
  45. }
  46. };
  47. }}}
  48. #endif