not_equal_to.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_NOT_EQUAL_TO_05052005_1141)
  8. #define FUSION_NOT_EQUAL_TO_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, bool same_size>
  18. struct sequence_not_equal_to
  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. || call(fusion::next(a), fusion::next(b));
  36. }
  37. template <typename I1, typename I2>
  38. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  39. static bool
  40. call(I1 const& a, I2 const& b)
  41. {
  42. typename result_of::equal_to<I1, end1_type>::type eq;
  43. return call(a, b, eq);
  44. }
  45. };
  46. template <typename Seq1, typename Seq2>
  47. struct sequence_not_equal_to<Seq1, Seq2, false>
  48. {
  49. template <typename I1, typename I2>
  50. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  51. static bool
  52. call(I1 const& a, I2 const& b)
  53. {
  54. return true;
  55. }
  56. };
  57. }}}
  58. #endif