2 #ifndef BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
3 #define BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2000-2004
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 // See http://www.boost.org/libs/mpl for documentation.
17 #include <boost/mpl/next_prior.hpp>
18 #include <boost/mpl/deref.hpp>
19 #include <boost/mpl/iterator_tags.hpp>
20 #include <boost/mpl/aux_/lambda_spec.hpp>
21 #include <boost/mpl/aux_/config/ctps.hpp>
23 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
24 # include <boost/type_traits/is_same.hpp>
27 namespace boost { namespace mpl {
29 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
33 , typename LastIterator1
38 typedef Iterator1 base;
39 typedef forward_iterator_tag category;
43 typename LastIterator1
46 struct joint_iter<LastIterator1,LastIterator1,Iterator2>
48 typedef Iterator2 base;
49 typedef forward_iterator_tag category;
53 template< typename I1, typename L1, typename I2 >
54 struct deref< joint_iter<I1,L1,I2> >
56 typedef typename joint_iter<I1,L1,I2>::base base_;
57 typedef typename deref<base_>::type type;
60 template< typename I1, typename L1, typename I2 >
61 struct next< joint_iter<I1,L1,I2> >
63 typedef joint_iter< typename mpl::next<I1>::type,L1,I2 > type;
66 template< typename L1, typename I2 >
67 struct next< joint_iter<L1,L1,I2> >
69 typedef joint_iter< L1,L1,typename mpl::next<I2>::type > type;
72 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
76 , typename LastIterator1
81 template< bool > struct joint_iter_impl
83 template< typename I1, typename L1, typename I2 > struct result_
86 typedef forward_iterator_tag category;
87 typedef joint_iter< typename mpl::next<I1>::type,L1,I2 > next;
88 typedef typename deref<I1>::type type;
92 template<> struct joint_iter_impl<true>
94 template< typename I1, typename L1, typename I2 > struct result_
97 typedef forward_iterator_tag category;
98 typedef joint_iter< L1,L1,typename mpl::next<I2>::type > next;
99 typedef typename deref<I2>::type type;
105 , typename LastIterator1
109 : joint_iter_impl< is_same<Iterator1,LastIterator1>::value >
110 ::template result_<Iterator1,LastIterator1,Iterator2>
114 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
116 BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, joint_iter)
120 #endif // BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED