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

Private GIT Repository
8d9913d8e3686c1abc964decb4553d1bd0522700
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / advance.hpp
1 \r
2 #ifndef BOOST_MPL_ADVANCE_HPP_INCLUDED\r
3 #define BOOST_MPL_ADVANCE_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: 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
16 \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
29 \r
30 namespace boost { namespace mpl {\r
31 \r
32 // default implementation for forward/bidirectional iterators\r
33 template< typename Tag >\r
34 struct advance_impl\r
35 {\r
36     template< typename Iterator, typename N > struct apply\r
37     {\r
38         typedef typename less< N,long_<0> >::type backward_;\r
39         typedef typename if_< backward_, negate<N>, N >::type offset_;\r
40 \r
41         typedef typename if_<\r
42               backward_\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
45             >::type f_;\r
46 \r
47         typedef typename apply_wrap1<f_,Iterator>::type type;\r
48     };\r
49 };\r
50 \r
51 \r
52 template<\r
53       typename BOOST_MPL_AUX_NA_PARAM(Iterator)\r
54     , typename BOOST_MPL_AUX_NA_PARAM(N)\r
55     >\r
56 struct advance\r
57     : advance_impl< typename tag<Iterator>::type >\r
58         ::template apply<Iterator,N>\r
59 {\r
60 };\r
61 \r
62 template<\r
63       typename Iterator\r
64     , BOOST_MPL_AUX_NTTP_DECL(long, N)\r
65     >\r
66 struct advance_c\r
67     : advance_impl< typename tag<Iterator>::type >\r
68         ::template apply<Iterator,long_<N> >\r
69 {\r
70 };\r
71 \r
72 BOOST_MPL_AUX_NA_SPEC(2, advance)\r
73 \r
74 }}\r
75 \r
76 #endif // BOOST_MPL_ADVANCE_HPP_INCLUDED\r