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_ITERATOR_FACADE_09252006_1011)
8 #define FUSION_ITERATOR_FACADE_09252006_1011
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/support/iterator_base.hpp>
12 #include <boost/fusion/iterator/detail/advance.hpp>
13 #include <boost/fusion/iterator/detail/distance.hpp>
14 #include <boost/fusion/support/category_of.hpp>
15 #include <boost/type_traits/is_same.hpp>
16 #include <boost/mpl/assert.hpp>
17 #include <boost/mpl/if.hpp>
19 namespace boost { namespace fusion
21 struct iterator_facade_tag;
23 template <typename Derived, typename Category>
24 struct iterator_facade : iterator_base<Derived>
26 typedef iterator_facade_tag fusion_tag;
27 typedef Derived derived_type;
28 typedef Category category;
30 // default implementation
31 template <typename I1, typename I2>
32 struct equal_to // default implementation
34 typename I1::derived_type
35 , typename I2::derived_type
39 // default implementation
40 template <typename Iterator, typename N>
44 , advance_detail::forward<Iterator, N::value>
45 , advance_detail::backward<Iterator, N::value>
48 BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
51 // default implementation
52 template <typename First, typename Last>
54 distance_detail::linear_distance<First, Last>
59 #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
62 template <typename Derived, typename Category>
63 struct iterator_traits< ::boost::fusion::iterator_facade<Derived, Category> >