~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/iterator.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  interator.hpp workarounds for non-conforming standard libraries  ---------//
 
2
 
 
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.
 
7
 
 
8
//  See http://www.boost.org/libs/utility for documentation.
 
9
 
 
10
//  Revision History
 
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)
 
14
 
 
15
#ifndef BOOST_ITERATOR_HPP
 
16
#define BOOST_ITERATOR_HPP
 
17
 
 
18
#include <iterator>
 
19
#include <cstddef>           // std::ptrdiff_t
 
20
#include <boost/config.hpp>
 
21
 
 
22
namespace boost
 
23
{
 
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&>
 
28
  struct iterator
 
29
  {
 
30
    typedef T         value_type;
 
31
    typedef Distance  difference_type;
 
32
    typedef Pointer   pointer;
 
33
    typedef Reference reference;
 
34
    typedef Category  iterator_category;
 
35
  };
 
36
# else
 
37
 
 
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.
 
40
  namespace detail {
 
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> {};
 
44
#  else
 
45
   struct iterator_base : std::iterator<Category, T, Distance>
 
46
   {
 
47
     typedef Reference reference;
 
48
     typedef Pointer pointer;
 
49
     typedef Distance difference_type;
 
50
   };
 
51
#  endif
 
52
  }
 
53
 
 
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> {};
 
57
# endif
 
58
} // namespace boost
 
59
 
 
60
#endif // BOOST_ITERATOR_HPP