not_equal_to.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_NOT_EQUAL_TO_05052005_0431)
  8. #define FUSION_NOT_EQUAL_TO_05052005_0431
  9. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  10. #include <boost/fusion/sequence/intrinsic/end.hpp>
  11. #include <boost/fusion/sequence/intrinsic/size.hpp>
  12. #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
  13. #if defined(FUSION_DIRECT_OPERATOR_USAGE)
  14. #include <boost/fusion/sequence/comparison/detail/not_equal_to.hpp>
  15. #else
  16. #include <boost/fusion/sequence/comparison/equal_to.hpp>
  17. #endif
  18. namespace boost { namespace fusion
  19. {
  20. template <typename Seq1, typename Seq2>
  21. inline bool
  22. not_equal_to(Seq1 const& a, Seq2 const& b)
  23. {
  24. #if defined(FUSION_DIRECT_OPERATOR_USAGE)
  25. return result_of::size<Seq1>::value != result_of::size<Seq2>::value
  26. || detail::sequence_not_equal_to<
  27. Seq1 const, Seq2 const
  28. , result_of::size<Seq1>::value == result_of::size<Seq2>::value>::
  29. call(fusion::begin(a), fusion::begin(b));
  30. #else
  31. return !(a == b);
  32. #endif
  33. }
  34. namespace operators
  35. {
  36. template <typename Seq1, typename Seq2>
  37. inline typename
  38. boost::enable_if<
  39. traits::enable_equality<Seq1, Seq2>
  40. , bool
  41. >::type
  42. operator!=(Seq1 const& a, Seq2 const& b)
  43. {
  44. return fusion::not_equal_to(a, b);
  45. }
  46. }
  47. using operators::operator!=;
  48. }}
  49. #endif