fix doc example typo
[boost.git] / boost / fusion / iterator / iterator_facade.hpp
blob3e0a926f2b36d82857b79b9318ed52181fb91e6a
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_ITERATOR_FACADE_09252006_1011)
8 #define FUSION_ITERATOR_FACADE_09252006_1011
10 #include <boost/fusion/support/iterator_base.hpp>
11 #include <boost/fusion/iterator/detail/advance.hpp>
12 #include <boost/fusion/iterator/detail/distance.hpp>
13 #include <boost/fusion/support/category_of.hpp>
14 #include <boost/type_traits/is_same.hpp>
15 #include <boost/mpl/assert.hpp>
17 namespace boost { namespace fusion
19 struct iterator_facade_tag;
21 template <typename Derived, typename Category>
22 struct iterator_facade : iterator_base<Derived>
24 typedef iterator_facade_tag fusion_tag;
25 typedef Derived derived_type;
26 typedef Category category;
28 // default implementation
29 template <typename I1, typename I2>
30 struct equal_to // default implementation
31 : is_same<
32 typename I1::derived_type
33 , typename I2::derived_type
35 {};
37 // default implementation
38 template <typename Iterator, typename N>
39 struct advance :
40 mpl::if_c<
41 (N::value > 0)
42 , advance_detail::forward<Iterator, N::value>
43 , advance_detail::backward<Iterator, N::value>
44 >::type
46 BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
49 // default implementation
50 template <typename First, typename Last>
51 struct distance :
52 distance_detail::linear_distance<First, Last>
58 #endif