equal_to_impl.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2006 Dan Marsden
  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_IMPL_20060128_1423)
  8. #define FUSION_EQUAL_TO_IMPL_20060128_1423
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/mpl.hpp>
  11. #include <boost/mpl/lambda.hpp>
  12. #include <boost/mpl/and.hpp>
  13. #include <boost/mpl/transform_view.hpp>
  14. #include <boost/mpl/zip_view.hpp>
  15. #include <boost/mpl/vector.hpp>
  16. #include <boost/mpl/unpack_args.hpp>
  17. #include <boost/mpl/find_if.hpp>
  18. #include <boost/mpl/end.hpp>
  19. #include <boost/mpl/bool.hpp>
  20. #include <boost/mpl/equal_to.hpp>
  21. #include <boost/type_traits/is_same.hpp>
  22. #include <boost/fusion/iterator/equal_to.hpp>
  23. namespace boost { namespace fusion {
  24. struct zip_view_iterator_tag;
  25. namespace detail
  26. {
  27. template<typename It1, typename It2>
  28. struct zip_iterators_equal
  29. {
  30. typedef mpl::zip_view<mpl::vector2<typename It1::iterators, typename It2::iterators> > zipped;
  31. typedef mpl::transform_view<zipped, mpl::unpack_args<result_of::equal_to<mpl::_,mpl::_> > > transformed;
  32. typedef typename mpl::find_if<transformed, mpl::equal_to<mpl::_, mpl::false_> >::type found;
  33. typedef typename is_same<typename mpl::end<transformed>::type, found>::type type;
  34. };
  35. }
  36. namespace extension
  37. {
  38. template<typename Tag>
  39. struct equal_to_impl;
  40. template<>
  41. struct equal_to_impl<zip_view_iterator_tag>
  42. {
  43. template<typename It1, typename It2>
  44. struct apply
  45. : detail::zip_iterators_equal<It1, It2>::type
  46. {};
  47. };
  48. }
  49. }}
  50. #endif