2 #ifndef BOOST_MPL_ADVANCE_HPP_INCLUDED
\r
3 #define BOOST_MPL_ADVANCE_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2000-2004
\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
11 // See http://www.boost.org/libs/mpl for documentation.
\r
13 // $Id: advance.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
17 #include <boost/mpl/advance_fwd.hpp>
\r
18 #include <boost/mpl/less.hpp>
\r
19 #include <boost/mpl/negate.hpp>
\r
20 #include <boost/mpl/long.hpp>
\r
21 #include <boost/mpl/if.hpp>
\r
22 #include <boost/mpl/tag.hpp>
\r
23 #include <boost/mpl/apply_wrap.hpp>
\r
24 #include <boost/mpl/aux_/advance_forward.hpp>
\r
25 #include <boost/mpl/aux_/advance_backward.hpp>
\r
26 #include <boost/mpl/aux_/value_wknd.hpp>
\r
27 #include <boost/mpl/aux_/na_spec.hpp>
\r
28 #include <boost/mpl/aux_/nttp_decl.hpp>
\r
30 namespace boost { namespace mpl {
\r
32 // default implementation for forward/bidirectional iterators
\r
33 template< typename Tag >
\r
36 template< typename Iterator, typename N > struct apply
\r
38 typedef typename less< N,long_<0> >::type backward_;
\r
39 typedef typename if_< backward_, negate<N>, N >::type offset_;
\r
41 typedef typename if_<
\r
43 , aux::advance_backward< BOOST_MPL_AUX_VALUE_WKND(offset_)::value >
\r
44 , aux::advance_forward< BOOST_MPL_AUX_VALUE_WKND(offset_)::value >
\r
47 typedef typename apply_wrap1<f_,Iterator>::type type;
\r
53 typename BOOST_MPL_AUX_NA_PARAM(Iterator)
\r
54 , typename BOOST_MPL_AUX_NA_PARAM(N)
\r
57 : advance_impl< typename tag<Iterator>::type >
\r
58 ::template apply<Iterator,N>
\r
64 , BOOST_MPL_AUX_NTTP_DECL(long, N)
\r
67 : advance_impl< typename tag<Iterator>::type >
\r
68 ::template apply<Iterator,long_<N> >
\r
72 BOOST_MPL_AUX_NA_SPEC(2, advance)
\r
76 #endif // BOOST_MPL_ADVANCE_HPP_INCLUDED
\r