equal_to.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/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/detail/equal_to.hpp>
  13. #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
  14. #include <boost/config.hpp>
  15. #if defined (BOOST_MSVC)
  16. # pragma warning(push)
  17. # pragma warning (disable: 4100) // unreferenced formal parameter
  18. #endif
  19. namespace boost { namespace fusion
  20. {
  21. template <typename Seq1, typename Seq2>
  22. inline bool
  23. equal_to(Seq1 const& a, Seq2 const& b)
  24. {
  25. return result_of::size<Seq1>::value == result_of::size<Seq2>::value
  26. && detail::sequence_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. }
  31. namespace operators
  32. {
  33. template <typename Seq1, typename Seq2>
  34. inline typename
  35. boost::enable_if<
  36. traits::enable_equality<Seq1, Seq2>
  37. , bool
  38. >::type
  39. operator==(Seq1 const& a, Seq2 const& b)
  40. {
  41. return fusion::equal_to(a, b);
  42. }
  43. }
  44. using operators::operator==;
  45. }}
  46. #if defined (BOOST_MSVC)
  47. # pragma warning(pop)
  48. #endif
  49. #endif