1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/pending/integer_range.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,59 @@
1.4 +// (C) Copyright David Abrahams and Jeremy Siek 2000-2001.
1.5 +// Distributed under the Boost Software License, Version 1.0. (See
1.6 +// accompanying file LICENSE_1_0.txt or copy at
1.7 +// http://www.boost.org/LICENSE_1_0.txt)
1.8 +//
1.9 +// Revision History:
1.10 +// 04 Jan 2001 Factored counting_iterator stuff into
1.11 +// boost/counting_iterator.hpp (David Abrahams)
1.12 +
1.13 +#ifndef BOOST_INTEGER_RANGE_HPP_
1.14 +#define BOOST_INTEGER_RANGE_HPP_
1.15 +
1.16 +#include <boost/config.hpp>
1.17 +#include <boost/iterator/counting_iterator.hpp>
1.18 +#include <algorithm>
1.19 +
1.20 +namespace boost {
1.21 +
1.22 +//=============================================================================
1.23 +// Counting Iterator and Integer Range Class
1.24 +
1.25 +template <class IntegerType>
1.26 +struct integer_range {
1.27 + typedef counting_iterator<IntegerType> iterator;
1.28 +
1.29 + typedef iterator const_iterator;
1.30 + typedef IntegerType value_type;
1.31 + typedef std::ptrdiff_t difference_type;
1.32 + typedef IntegerType reference;
1.33 + typedef IntegerType const_reference;
1.34 + typedef const IntegerType* pointer;
1.35 + typedef const IntegerType* const_pointer;
1.36 + typedef IntegerType size_type;
1.37 +
1.38 + integer_range(IntegerType start, IntegerType finish)
1.39 + : m_start(start), m_finish(finish) { }
1.40 +
1.41 + iterator begin() const { return iterator(m_start); }
1.42 + iterator end() const { return iterator(m_finish); }
1.43 + size_type size() const { return m_finish - m_start; }
1.44 + bool empty() const { return m_finish == m_start; }
1.45 + void swap(integer_range& x) {
1.46 + std::swap(m_start, x.m_start);
1.47 + std::swap(m_finish, x.m_finish);
1.48 + }
1.49 +protected:
1.50 + IntegerType m_start, m_finish;
1.51 +};
1.52 +
1.53 +template <class IntegerType>
1.54 +inline integer_range<IntegerType>
1.55 +make_integer_range(IntegerType first, IntegerType last)
1.56 +{
1.57 + return integer_range<IntegerType>(first, last);
1.58 +}
1.59 +
1.60 +} // namespace boost
1.61 +
1.62 +#endif // BOOST_INTEGER_RANGE_HPP_