summaryrefslogtreecommitdiffstats
blob: 6adab0e6959987d5c700e72057778ea5e3e760e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//  iterator.hpp workarounds for non-conforming standard libraries  ---------//

//  (C) Copyright Beman Dawes 2000. Distributed under the Boost
//  Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org/libs/utility for documentation.

//  Revision History
//  12 Jan 01 added <cstddef> for std::ptrdiff_t (Jens Maurer)
//  28 Jun 00 Workarounds to deal with known MSVC bugs (David Abrahams)
//  26 Jun 00 Initial version (Jeremy Siek)

#ifndef BOOST_ITERATOR_HPP
#define BOOST_ITERATOR_HPP

#include <iterator>
#include <cstddef>           // std::ptrdiff_t
#include <boost/config.hpp>

namespace boost
{
# if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR)
  template <class Category, class T,
    class Distance = std::ptrdiff_t,
    class Pointer = T*, class Reference = T&>
  struct iterator
  {
    typedef T         value_type;
    typedef Distance  difference_type;
    typedef Pointer   pointer;
    typedef Reference reference;
    typedef Category  iterator_category;
  };
# else

  // declare iterator_base in namespace detail to work around MSVC bugs which
  // prevent derivation from an identically-named class in a different namespace.
  namespace detail {
   template <class Category, class T, class Distance, class Pointer, class Reference>
#  if !defined(BOOST_MSVC_STD_ITERATOR)
   struct iterator_base : std::iterator<Category, T, Distance, Pointer, Reference> {};
#  else
   struct iterator_base : std::iterator<Category, T, Distance>
   {
     typedef Reference reference;
     typedef Pointer pointer;
     typedef Distance difference_type;
   };
#  endif
  }

  template <class Category, class T, class Distance = std::ptrdiff_t,
            class Pointer = T*, class Reference = T&>
  struct iterator : boost::detail::iterator_base<Category, T, Distance, Pointer, Reference> {};
# endif
} // namespace boost

#endif // BOOST_ITERATOR_HPP