epoc32/include/stdapis/boost/mpl/next_prior.hpp
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/next_prior.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +//  Boost next_prior.hpp header file  ---------------------------------------//
     1.5 +
     1.6 +//  (C) Copyright Dave Abrahams and Daniel Walker 1999-2003. Distributed under the Boost
     1.7 +//  Software License, Version 1.0. (See accompanying file
     1.8 +//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
     1.9 +
    1.10 +//  See http://www.boost.org/libs/utility for documentation.
    1.11 +
    1.12 +//  Revision History
    1.13 +//  13 Dec 2003  Added next(x, n) and prior(x, n) (Daniel Walker)
    1.14 +
    1.15 +#ifndef BOOST_NEXT_PRIOR_HPP_INCLUDED
    1.16 +#define BOOST_NEXT_PRIOR_HPP_INCLUDED
    1.17 +
    1.18 +#include <iterator>
    1.19 +
    1.20 +namespace boost {
    1.21 +
    1.22 +//  Helper functions for classes like bidirectional iterators not supporting
    1.23 +//  operator+ and operator-
    1.24 +//
    1.25 +//  Usage:
    1.26 +//    const std::list<T>::iterator p = get_some_iterator();
    1.27 +//    const std::list<T>::iterator prev = boost::prior(p);
    1.28 +//    const std::list<T>::iterator next = boost::next(prev, 2);
    1.29 +
    1.30 +//  Contributed by Dave Abrahams
    1.31 +
    1.32 +template <class T>
    1.33 +inline T next(T x) { return ++x; }
    1.34 +
    1.35 +template <class T, class Distance>
    1.36 +inline T next(T x, Distance n)
    1.37 +{
    1.38 +    std::advance(x, n);
    1.39 +    return x;
    1.40 +}
    1.41 +
    1.42 +template <class T>
    1.43 +inline T prior(T x) { return --x; }
    1.44 +
    1.45 +template <class T, class Distance>
    1.46 +inline T prior(T x, Distance n)
    1.47 +{
    1.48 +    std::advance(x, -n);
    1.49 +    return x;
    1.50 +}
    1.51 +
    1.52 +} // namespace boost
    1.53 +
    1.54 +#endif  // BOOST_NEXT_PRIOR_HPP_INCLUDED