File indexing completed on 2025-01-18 09:41:55
0001
0002 #ifndef BOOST_MPL_ADVANCE_HPP_INCLUDED
0003 #define BOOST_MPL_ADVANCE_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/advance_fwd.hpp>
0018 #include <boost/mpl/less.hpp>
0019 #include <boost/mpl/negate.hpp>
0020 #include <boost/mpl/long.hpp>
0021 #include <boost/mpl/if.hpp>
0022 #include <boost/mpl/tag.hpp>
0023 #include <boost/mpl/apply_wrap.hpp>
0024 #include <boost/mpl/aux_/advance_forward.hpp>
0025 #include <boost/mpl/aux_/advance_backward.hpp>
0026 #include <boost/mpl/aux_/value_wknd.hpp>
0027 #include <boost/mpl/aux_/na_spec.hpp>
0028 #include <boost/mpl/aux_/nttp_decl.hpp>
0029
0030 namespace boost { namespace mpl {
0031
0032
0033 template< typename Tag >
0034 struct advance_impl
0035 {
0036 template< typename Iterator, typename N > struct apply
0037 {
0038 typedef typename less< N,long_<0> >::type backward_;
0039 typedef typename if_< backward_, negate<N>, N >::type offset_;
0040
0041 typedef typename if_<
0042 backward_
0043 , aux::advance_backward< BOOST_MPL_AUX_VALUE_WKND(offset_)::value >
0044 , aux::advance_forward< BOOST_MPL_AUX_VALUE_WKND(offset_)::value >
0045 >::type f_;
0046
0047 typedef typename apply_wrap1<f_,Iterator>::type type;
0048 };
0049 };
0050
0051
0052 template<
0053 typename BOOST_MPL_AUX_NA_PARAM(Iterator)
0054 , typename BOOST_MPL_AUX_NA_PARAM(N)
0055 >
0056 struct advance
0057 : advance_impl< typename tag<Iterator>::type >
0058 ::template apply<Iterator,N>
0059 {
0060 };
0061
0062 template<
0063 typename Iterator
0064 , BOOST_MPL_AUX_NTTP_DECL(long, N)
0065 >
0066 struct advance_c
0067 : advance_impl< typename tag<Iterator>::type >
0068 ::template apply<Iterator,long_<N> >
0069 {
0070 };
0071
0072 BOOST_MPL_AUX_NA_SPEC(2, advance)
0073
0074 }}
0075
0076 #endif