blob: cc03767293041fd61432ec512458cb94470498c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_MPL_ITERATOR_05052005_0731)
#define FUSION_MPL_ITERATOR_05052005_0731
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/mpl_iterator_category.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/prior.hpp>
#include <boost/mpl/advance.hpp>
#include <boost/mpl/distance.hpp>
namespace boost { namespace fusion
{
template <typename Iterator_>
struct mpl_iterator
: iterator_facade<
mpl_iterator<Iterator_>
, typename detail::mpl_iterator_category<typename Iterator_::category>::type
>
{
typedef typename remove_const<Iterator_>::type iterator_type;
template <typename Iterator>
struct value_of : mpl::deref<typename Iterator::iterator_type> {};
template <typename Iterator>
struct deref
{
typedef typename mpl::deref<
typename Iterator::iterator_type>::type
type;
BOOST_FUSION_GPU_ENABLED
static type
call(Iterator)
{
return type();
}
};
template <typename Iterator>
struct next
{
typedef mpl_iterator<
typename mpl::next<typename Iterator::iterator_type>::type>
type;
BOOST_FUSION_GPU_ENABLED
static type
call(Iterator)
{
return type();
}
};
template <typename Iterator>
struct prior
{
typedef mpl_iterator<
typename mpl::prior<typename Iterator::iterator_type>::type>
type;
BOOST_FUSION_GPU_ENABLED
static type
call(Iterator)
{
return type();
}
};
template <typename Iterator, typename N>
struct advance
{
typedef mpl_iterator<
typename mpl::advance<typename Iterator::iterator_type, N>::type>
type;
BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& /*i*/)
{
return type();
}
};
template <typename I1, typename I2>
struct distance :
mpl::distance<
typename I1::iterator_type
, typename I2::iterator_type>
{
typedef typename
mpl::distance<
typename I1::iterator_type
, typename I2::iterator_type
>::type
type;
BOOST_FUSION_GPU_ENABLED
static type
call(I1 const&, I2 const&)
{
return type();
}
};
};
}}
#endif
|