epoc32/include/stdapis/boost/pending/integer_range.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h) This is the epoc32/include tree with the "platform" subtrees removed, and all but a selected few mbg and rsg files removed.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
// (C) Copyright David Abrahams and Jeremy Siek 2000-2001.
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
// Distributed under the Boost Software License, Version 1.0. (See
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
// accompanying file LICENSE_1_0.txt or copy at
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
// http://www.boost.org/LICENSE_1_0.txt)
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
//
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
// Revision History:
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
// 04 Jan 2001  Factored counting_iterator stuff into
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
//              boost/counting_iterator.hpp (David Abrahams)
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
#ifndef BOOST_INTEGER_RANGE_HPP_
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
#define BOOST_INTEGER_RANGE_HPP_
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
#include <boost/config.hpp>
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
#include <boost/iterator/counting_iterator.hpp>
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
#include <algorithm>
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
namespace boost {
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
//=============================================================================
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
// Counting Iterator and Integer Range Class
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
template <class IntegerType>
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
struct integer_range {
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
    typedef counting_iterator<IntegerType> iterator;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
    typedef iterator const_iterator;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
    typedef IntegerType value_type;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
    typedef std::ptrdiff_t difference_type;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
    typedef IntegerType reference;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
    typedef IntegerType const_reference;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
    typedef const IntegerType* pointer;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
    typedef const IntegerType* const_pointer;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
    typedef IntegerType size_type;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
    integer_range(IntegerType start, IntegerType finish)
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
        : m_start(start), m_finish(finish) { }
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
    iterator begin() const { return iterator(m_start); }
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
    iterator end() const { return iterator(m_finish); }
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
    size_type size() const { return m_finish - m_start; }
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
    bool empty() const { return m_finish == m_start; }
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
    void swap(integer_range& x) {
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
        std::swap(m_start, x.m_start);
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
        std::swap(m_finish, x.m_finish);
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
    }
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
protected:
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
    IntegerType m_start, m_finish;
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
};
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
template <class IntegerType>
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
inline integer_range<IntegerType>
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
make_integer_range(IntegerType first, IntegerType last)
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
{
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
  return integer_range<IntegerType>(first, last);
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
}
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
} // namespace boost
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
2fe1408b6811 Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
#endif // BOOST_INTEGER_RANGE_HPP_