1 // interator.hpp workarounds for non-conforming standard libraries ---------//
3 // (C) Copyright Boost.org 2000. Permission to copy, use, modify, sell and
4 // distribute this software is granted provided this copyright notice appears
5 // in all copies. This software is provided "as is" without express or implied
6 // warranty, and with no claim as to its suitability for any purpose.
8 // See http://www.boost.org/libs/utility for documentation.
11 // 12 Jan 01 added <cstddef> for std::ptrdiff_t (Jens Maurer)
12 // 28 Jun 00 Workarounds to deal with known MSVC bugs (David Abrahams)
13 // 26 Jun 00 Initial version (Jeremy Siek)
15 #ifndef BOOST_ITERATOR_HPP
16 #define BOOST_ITERATOR_HPP
19 #include <cstddef> // std::ptrdiff_t
20 #include <boost/config.hpp>
24 # if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR)
25 template <class Category, class T,
26 class Distance = std::ptrdiff_t,
27 class Pointer = T*, class Reference = T&>
31 typedef Distance difference_type;
32 typedef Pointer pointer;
33 typedef Reference reference;
34 typedef Category iterator_category;
38 // declare iterator_base in namespace detail to work around MSVC bugs which
39 // prevent derivation from an identically-named class in a different namespace.
41 template <class Category, class T, class Distance, class Pointer, class Reference>
42 # if !defined(BOOST_MSVC_STD_ITERATOR)
43 struct iterator_base : std::iterator<Category, T, Distance, Pointer, Reference> {};
45 struct iterator_base : std::iterator<Category, T, Distance>
47 typedef Reference reference;
48 typedef Pointer pointer;
49 typedef Distance difference_type;
54 template <class Category, class T, class Distance = std::ptrdiff_t,
55 class Pointer = T*, class Reference = T&>
56 struct iterator : detail::iterator_base<Category, T, Distance, Pointer, Reference> {};
60 #endif // BOOST_ITERATOR_HPP