1 /*=============================================================================
2 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_1208)
8 #define FUSION_EQUAL_TO_05052005_1208
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/type_traits/is_same.hpp>
12 #include <boost/fusion/support/tag_of.hpp>
13 #include <boost/type_traits/add_const.hpp>
14 #include <boost/fusion/support/is_iterator.hpp>
15 #include <boost/mpl/and.hpp>
16 #include <boost/utility/enable_if.hpp>
18 namespace boost { namespace fusion
21 struct iterator_facade_tag; // iterator facade tag
22 struct boost_array_iterator_tag; // boost::array iterator tag
23 struct mpl_iterator_tag; // mpl sequence iterator tag
24 struct std_pair_iterator_tag; // std::pair iterator tag
28 template <typename Tag>
31 // default implementation
32 template <typename I1, typename I2>
34 : is_same<typename add_const<I1>::type, typename add_const<I2>::type>
39 struct equal_to_impl<iterator_facade_tag>
41 template <typename It1, typename It2, typename Tag1, typename Tag2>
42 struct dispatch : mpl::false_ {};
44 template <typename It1, typename It2, typename Tag>
45 struct dispatch<It1, It2, Tag, Tag> // same tag
46 : It1::template equal_to<It1, It2>
49 template<typename It1, typename It2>
50 struct apply : dispatch<It1, It2,
51 typename It1::fusion_tag, typename It2::fusion_tag>
56 struct equal_to_impl<boost_array_iterator_tag>;
59 struct equal_to_impl<mpl_iterator_tag>;
62 struct equal_to_impl<std_pair_iterator_tag>;
67 template <typename I1, typename I2>
69 : extension::equal_to_impl<typename detail::tag_of<I1>::type>::
70 template apply<I1, I2>
74 namespace iterator_operators
76 template <typename Iter1, typename Iter2>
77 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
80 mpl::and_<is_fusion_iterator<Iter1>, is_fusion_iterator<Iter2> >
83 operator==(Iter1 const&, Iter2 const&)
85 return result_of::equal_to<Iter1, Iter2>::value;
88 template <typename Iter1, typename Iter2>
89 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
92 mpl::and_<is_fusion_iterator<Iter1>, is_fusion_iterator<Iter2> >
95 operator!=(Iter1 const&, Iter2 const&)
97 return !result_of::equal_to<Iter1, Iter2>::value;
101 using iterator_operators::operator==;
102 using iterator_operators::operator!=;