Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2000-2004
|
Chris@16
|
6 //
|
Chris@16
|
7 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
8 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10 //
|
Chris@16
|
11 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
12
|
Chris@101
|
13 // $Id$
|
Chris@101
|
14 // $Date$
|
Chris@101
|
15 // $Revision$
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/mpl/next_prior.hpp>
|
Chris@16
|
18 #include <boost/mpl/deref.hpp>
|
Chris@16
|
19 #include <boost/mpl/iterator_tags.hpp>
|
Chris@16
|
20 #include <boost/mpl/aux_/lambda_spec.hpp>
|
Chris@16
|
21 #include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
22
|
Chris@16
|
23 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
24 # include <boost/type_traits/is_same.hpp>
|
Chris@16
|
25 #endif
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost { namespace mpl {
|
Chris@16
|
28
|
Chris@16
|
29 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
30
|
Chris@16
|
31 template<
|
Chris@16
|
32 typename Iterator1
|
Chris@16
|
33 , typename LastIterator1
|
Chris@16
|
34 , typename Iterator2
|
Chris@16
|
35 >
|
Chris@16
|
36 struct joint_iter
|
Chris@16
|
37 {
|
Chris@16
|
38 typedef Iterator1 base;
|
Chris@16
|
39 typedef forward_iterator_tag category;
|
Chris@16
|
40 };
|
Chris@16
|
41
|
Chris@16
|
42 template<
|
Chris@16
|
43 typename LastIterator1
|
Chris@16
|
44 , typename Iterator2
|
Chris@16
|
45 >
|
Chris@16
|
46 struct joint_iter<LastIterator1,LastIterator1,Iterator2>
|
Chris@16
|
47 {
|
Chris@16
|
48 typedef Iterator2 base;
|
Chris@16
|
49 typedef forward_iterator_tag category;
|
Chris@16
|
50 };
|
Chris@16
|
51
|
Chris@16
|
52
|
Chris@16
|
53 template< typename I1, typename L1, typename I2 >
|
Chris@16
|
54 struct deref< joint_iter<I1,L1,I2> >
|
Chris@16
|
55 {
|
Chris@16
|
56 typedef typename joint_iter<I1,L1,I2>::base base_;
|
Chris@16
|
57 typedef typename deref<base_>::type type;
|
Chris@16
|
58 };
|
Chris@16
|
59
|
Chris@16
|
60 template< typename I1, typename L1, typename I2 >
|
Chris@16
|
61 struct next< joint_iter<I1,L1,I2> >
|
Chris@16
|
62 {
|
Chris@16
|
63 typedef joint_iter< typename mpl::next<I1>::type,L1,I2 > type;
|
Chris@16
|
64 };
|
Chris@16
|
65
|
Chris@16
|
66 template< typename L1, typename I2 >
|
Chris@16
|
67 struct next< joint_iter<L1,L1,I2> >
|
Chris@16
|
68 {
|
Chris@16
|
69 typedef joint_iter< L1,L1,typename mpl::next<I2>::type > type;
|
Chris@16
|
70 };
|
Chris@16
|
71
|
Chris@16
|
72 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
73
|
Chris@16
|
74 template<
|
Chris@16
|
75 typename Iterator1
|
Chris@16
|
76 , typename LastIterator1
|
Chris@16
|
77 , typename Iterator2
|
Chris@16
|
78 >
|
Chris@16
|
79 struct joint_iter;
|
Chris@16
|
80
|
Chris@16
|
81 template< bool > struct joint_iter_impl
|
Chris@16
|
82 {
|
Chris@16
|
83 template< typename I1, typename L1, typename I2 > struct result_
|
Chris@16
|
84 {
|
Chris@16
|
85 typedef I1 base;
|
Chris@16
|
86 typedef forward_iterator_tag category;
|
Chris@16
|
87 typedef joint_iter< typename mpl::next<I1>::type,L1,I2 > next;
|
Chris@16
|
88 typedef typename deref<I1>::type type;
|
Chris@16
|
89 };
|
Chris@16
|
90 };
|
Chris@16
|
91
|
Chris@16
|
92 template<> struct joint_iter_impl<true>
|
Chris@16
|
93 {
|
Chris@16
|
94 template< typename I1, typename L1, typename I2 > struct result_
|
Chris@16
|
95 {
|
Chris@16
|
96 typedef I2 base;
|
Chris@16
|
97 typedef forward_iterator_tag category;
|
Chris@16
|
98 typedef joint_iter< L1,L1,typename mpl::next<I2>::type > next;
|
Chris@16
|
99 typedef typename deref<I2>::type type;
|
Chris@16
|
100 };
|
Chris@16
|
101 };
|
Chris@16
|
102
|
Chris@16
|
103 template<
|
Chris@16
|
104 typename Iterator1
|
Chris@16
|
105 , typename LastIterator1
|
Chris@16
|
106 , typename Iterator2
|
Chris@16
|
107 >
|
Chris@16
|
108 struct joint_iter
|
Chris@16
|
109 : joint_iter_impl< is_same<Iterator1,LastIterator1>::value >
|
Chris@16
|
110 ::template result_<Iterator1,LastIterator1,Iterator2>
|
Chris@16
|
111 {
|
Chris@16
|
112 };
|
Chris@16
|
113
|
Chris@16
|
114 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
115
|
Chris@16
|
116 BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, joint_iter)
|
Chris@16
|
117
|
Chris@16
|
118 }}
|
Chris@16
|
119
|
Chris@16
|
120 #endif // BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
|