1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2006 Dan Marsden
4 
5     Distributed under the Boost Software License, Version 1.0. (See accompanying
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(FUSION_EQUAL_TO_IMPL_20060128_1423)
9 #define FUSION_EQUAL_TO_IMPL_20060128_1423
10 
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/mpl.hpp>
13 
14 #include <boost/mpl/lambda.hpp>
15 #include <boost/mpl/and.hpp>
16 #include <boost/mpl/transform_view.hpp>
17 #include <boost/mpl/zip_view.hpp>
18 #include <boost/mpl/vector.hpp>
19 #include <boost/mpl/unpack_args.hpp>
20 #include <boost/mpl/find_if.hpp>
21 #include <boost/mpl/end.hpp>
22 #include <boost/mpl/bool.hpp>
23 #include <boost/mpl/equal_to.hpp>
24 
25 #include <boost/type_traits/is_same.hpp>
26 
27 #include <boost/fusion/iterator/equal_to.hpp>
28 
29 namespace boost { namespace fusion {
30 
31     struct zip_view_iterator_tag;
32 
33     namespace detail
34     {
35         template<typename It1, typename It2>
36         struct zip_iterators_equal
37         {
38             typedef mpl::zip_view<mpl::vector2<typename It1::iterators, typename It2::iterators> > zipped;
39             typedef mpl::transform_view<zipped, mpl::unpack_args<result_of::equal_to<mpl::_,mpl::_> > > transformed;
40 
41             typedef typename mpl::find_if<transformed, mpl::equal_to<mpl::_, mpl::false_> >::type found;
42 
43             typedef typename is_same<typename mpl::end<transformed>::type, found>::type type;
44         };
45     }
46 
47     namespace extension
48     {
49         template<typename Tag>
50         struct equal_to_impl;
51 
52         template<>
53         struct equal_to_impl<zip_view_iterator_tag>
54         {
55             template<typename It1, typename It2>
56             struct apply
57                 : detail::zip_iterators_equal<It1, It2>::type
58             {};
59         };
60     }
61 }}
62 
63 #endif
64