]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/aux_/joint_iter.hpp
Logo AND Algorithmique Numérique Distribuée

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