]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/iterator/iterator_facade.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / iterator / iterator_facade.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3
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
9
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>
16
17 namespace boost { namespace fusion
18 {
19     struct iterator_facade_tag;
20
21     template <typename Derived, typename Category>
22     struct iterator_facade : iterator_base<Derived>
23     {
24         typedef iterator_facade_tag fusion_tag;
25         typedef Derived derived_type;
26         typedef Category category;
27
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
34             >
35         {};
36
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
45         {
46             BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
47         };
48
49         // default implementation
50         template <typename First, typename Last>
51         struct distance :
52             distance_detail::linear_distance<First, Last>
53         {};
54     };
55 }}
56
57 #endif