/Src/Dependencies/Boost/boost/fusion/sequence/comparison/detail/equal_to.hpp

http://hadesmem.googlecode.com/ · C++ Header · 60 lines · 46 code · 7 blank · 7 comment · 2 complexity · 034a330c29f38dec468ac871b21f3a05 MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 1999-2003 Jaakko Jarvi
  3. Copyright (c) 2001-2006 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_1142)
  8. #define FUSION_EQUAL_TO_05052005_1142
  9. #include <boost/mpl/bool.hpp>
  10. #include <boost/fusion/iterator/deref.hpp>
  11. #include <boost/fusion/iterator/next.hpp>
  12. #include <boost/fusion/iterator/equal_to.hpp>
  13. namespace boost { namespace fusion { namespace detail
  14. {
  15. template <typename Seq1, typename Seq2, bool same_size>
  16. struct sequence_equal_to
  17. {
  18. typedef typename result_of::end<Seq1>::type end1_type;
  19. typedef typename result_of::end<Seq2>::type end2_type;
  20. template <typename I1, typename I2>
  21. static bool
  22. call(I1 const&, I2 const&, mpl::true_)
  23. {
  24. return true;
  25. }
  26. template <typename I1, typename I2>
  27. static bool
  28. call(I1 const& a, I2 const& b, mpl::false_)
  29. {
  30. return *a == *b
  31. && call(fusion::next(a), fusion::next(b));
  32. }
  33. template <typename I1, typename I2>
  34. static bool
  35. call(I1 const& a, I2 const& b)
  36. {
  37. typename result_of::equal_to<I1, end1_type>::type eq;
  38. return call(a, b, eq);
  39. }
  40. };
  41. template <typename Seq1, typename Seq2>
  42. struct sequence_equal_to<Seq1, Seq2, false>
  43. {
  44. template <typename I1, typename I2>
  45. static bool
  46. call(I1 const& /*a*/, I2 const& /*b*/)
  47. {
  48. return false;
  49. }
  50. };
  51. }}}
  52. #endif