Pack required boost code together.
[xy_vsfilter.git] / src / thirdparty / boost_1_47_0 / boost / mpl / aux_ / single_element_iter.hpp
blob0b37acc5e4e9022cd40be9567edd43143c237dd1
2 #ifndef BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_HPP_INCLUDED
3 #define BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2000-2004
6 //
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.
13 // $Id: single_element_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
15 // $Revision: 49267 $
17 #include <boost/mpl/iterator_tags.hpp>
18 #include <boost/mpl/advance_fwd.hpp>
19 #include <boost/mpl/distance_fwd.hpp>
20 #include <boost/mpl/next_prior.hpp>
21 #include <boost/mpl/deref.hpp>
22 #include <boost/mpl/int.hpp>
23 #include <boost/mpl/aux_/nttp_decl.hpp>
24 #include <boost/mpl/aux_/value_wknd.hpp>
25 #include <boost/mpl/aux_/config/ctps.hpp>
27 namespace boost { namespace mpl {
29 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
31 namespace aux {
33 template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_) >
34 struct sel_iter;
36 template< typename T >
37 struct sel_iter<T,0>
39 typedef random_access_iterator_tag category;
40 typedef sel_iter<T,1> next;
41 typedef T type;
44 template< typename T >
45 struct sel_iter<T,1>
47 typedef random_access_iterator_tag category;
48 typedef sel_iter<T,0> prior;
51 } // namespace aux
53 template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_), typename Distance >
54 struct advance< aux::sel_iter<T,is_last_>,Distance>
56 typedef aux::sel_iter<
58 , ( is_last_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Distance) )
59 > type;
62 template<
63 typename T
64 , BOOST_MPL_AUX_NTTP_DECL(int, l1)
65 , BOOST_MPL_AUX_NTTP_DECL(int, l2)
67 struct distance< aux::sel_iter<T,l1>, aux::sel_iter<T,l2> >
68 : int_<( l2 - l1 )>
72 #else
74 namespace aux {
76 struct sel_iter_tag;
78 template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_) >
79 struct sel_iter
81 enum { pos_ = is_last_ };
82 typedef aux::sel_iter_tag tag;
83 typedef random_access_iterator_tag category;
85 typedef sel_iter<T,(is_last_ + 1)> next;
86 typedef sel_iter<T,(is_last_ - 1)> prior;
87 typedef T type;
90 } // namespace aux
92 template<> struct advance_impl<aux::sel_iter_tag>
94 template< typename Iterator, typename N > struct apply
96 enum { pos_ = Iterator::pos_, n_ = N::value };
97 typedef aux::sel_iter<
98 typename Iterator::type
99 , (pos_ + n_)
100 > type;
104 template<> struct distance_impl<aux::sel_iter_tag>
106 template< typename Iter1, typename Iter2 > struct apply
108 enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ };
109 typedef int_<( pos2_ - pos1_ )> type;
110 BOOST_STATIC_CONSTANT(int, value = ( pos2_ - pos1_ ));
114 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
118 #endif // BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_HPP_INCLUDED