equal_to.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_EQUAL_TO_05052005_0431)
  8. #define FUSION_EQUAL_TO_05052005_0431
  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/detail/equal_to.hpp>
  14. #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
  15. #include <boost/config.hpp>
  16. #if defined (BOOST_MSVC)
  17. # pragma warning(push)
  18. # pragma warning (disable: 4100) // unreferenced formal parameter
  19. #endif
  20. namespace boost { namespace fusion
  21. {
  22. template <typename Seq1, typename Seq2>
  23. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  24. inline bool
  25. equal_to(Seq1 const& a, Seq2 const& b)
  26. {
  27. return result_of::size<Seq1>::value == result_of::size<Seq2>::value
  28. && detail::sequence_equal_to<
  29. Seq1 const, Seq2 const
  30. , result_of::size<Seq1>::value == result_of::size<Seq2>::value>::
  31. call(fusion::begin(a), fusion::begin(b));
  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_equality<Seq1, Seq2>
  40. , bool
  41. >::type
  42. operator==(Seq1 const& a, Seq2 const& b)
  43. {
  44. return fusion::equal_to(a, b);
  45. }
  46. }
  47. using operators::operator==;
  48. }}
  49. #if defined (BOOST_MSVC)
  50. # pragma warning(pop)
  51. #endif
  52. #endif