1 /*=============================================================================
2 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_1208)
8 #define FUSION_EQUAL_TO_05052005_1208
10 #include <boost/type_traits/is_same.hpp>
11 #include <boost/fusion/support/tag_of.hpp>
12 #include <boost/type_traits/add_const.hpp>
13 #include <boost/fusion/support/is_iterator.hpp>
14 #include <boost/mpl/and.hpp>
15 #include <boost/utility/enable_if.hpp>
17 namespace boost
{ namespace fusion
20 struct iterator_facade_tag
; // iterator facade tag
21 struct array_iterator_tag
; // boost::array iterator tag
22 struct mpl_iterator_tag
; // mpl sequence iterator tag
23 struct std_pair_iterator_tag
; // std::pair iterator tag
27 template <typename Tag
>
30 // default implementation
31 template <typename I1
, typename I2
>
33 : is_same
<typename add_const
<I1
>::type
, typename add_const
<I2
>::type
>
38 struct equal_to_impl
<iterator_facade_tag
>
40 template <typename I1
, typename I2
>
41 struct apply
: I1::template equal_to
<I1
, I2
> {};
45 struct equal_to_impl
<array_iterator_tag
>;
48 struct equal_to_impl
<mpl_iterator_tag
>;
51 struct equal_to_impl
<std_pair_iterator_tag
>;
56 template <typename I1
, typename I2
>
58 : extension::equal_to_impl
<typename
detail::tag_of
<I1
>::type
>::
59 template apply
<I1
, I2
>
63 namespace iterator_operators
65 template <typename Iter1
, typename Iter2
>
68 mpl::and_
<is_fusion_iterator
<Iter1
>, is_fusion_iterator
<Iter2
> >
71 operator==(Iter1
const&, Iter2
const&)
73 return result_of::equal_to
<Iter1
, Iter2
>::value
;
76 template <typename Iter1
, typename Iter2
>
79 mpl::and_
<is_fusion_iterator
<Iter1
>, is_fusion_iterator
<Iter2
> >
82 operator!=(Iter1
const&, Iter2
const&)
84 return !result_of::equal_to
<Iter1
, Iter2
>::value
;
88 using iterator_operators::operator==;
89 using iterator_operators::operator!=;