iterator.h

00001 /* 00002 * 00003 * Copyright (c) 1994 00004 * Hewlett-Packard Company 00005 * 00006 * Permission to use, copy, modify, distribute and sell this software 00007 * and its documentation for any purpose is hereby granted without fee, 00008 * provided that the above copyright notice appear in all copies and 00009 * that both that copyright notice and this permission notice appear 00010 * in supporting documentation. Hewlett-Packard Company makes no 00011 * representations about the suitability of this software for any 00012 * purpose. It is provided "as is" without express or implied warranty. 00013 * 00014 * 00015 * Copyright (c) 1996 00016 * Silicon Graphics Computer Systems, Inc. 00017 * 00018 * Permission to use, copy, modify, distribute and sell this software 00019 * and its documentation for any purpose is hereby granted without fee, 00020 * provided that the above copyright notice appear in all copies and 00021 * that both that copyright notice and this permission notice appear 00022 * in supporting documentation. Silicon Graphics makes no 00023 * representations about the suitability of this software for any 00024 * purpose. It is provided "as is" without express or implied warranty. 00025 */ 00026 00027 #ifndef _CPP_BACKWARD_ITERATOR_H 00028 #define _CPP_BACKWARD_ITERATOR_H 1 00029 00030 #include "backward_warning.h" 00031 #include "function.h" 00032 #include <stddef.h> 00033 #include "iostream.h" 00034 #include <iterator> 00035 00036 #include <bits/stl_construct.h> 00037 #include <bits/stl_raw_storage_iter.h> 00038 00039 #include <ext/iterator> // For 3-parameter distance extension 00040 00041 // Names from stl_iterator.h 00042 using std::input_iterator_tag; 00043 using std::output_iterator_tag; 00044 using std::forward_iterator_tag; 00045 using std::bidirectional_iterator_tag; 00046 using std::random_access_iterator_tag; 00047 00048 #if 0 00049 using std::iterator; 00050 #endif 00051 00052 // The base classes input_iterator, output_iterator, forward_iterator, 00053 // bidirectional_iterator, and random_access_iterator are not part of 00054 // the C++ standard. (They have been replaced by struct iterator.) 00055 // They are included for backward compatibility with the HP STL. 00056 template<typename _Tp, typename _Distance> 00057 struct input_iterator { 00058 typedef input_iterator_tag iterator_category; 00059 typedef _Tp value_type; 00060 typedef _Distance difference_type; 00061 typedef _Tp* pointer; 00062 typedef _Tp& reference; 00063 }; 00064 00065 struct output_iterator { 00066 typedef output_iterator_tag iterator_category; 00067 typedef void value_type; 00068 typedef void difference_type; 00069 typedef void pointer; 00070 typedef void reference; 00071 }; 00072 00073 template<typename _Tp, typename _Distance> 00074 struct forward_iterator { 00075 typedef forward_iterator_tag iterator_category; 00076 typedef _Tp value_type; 00077 typedef _Distance difference_type; 00078 typedef _Tp* pointer; 00079 typedef _Tp& reference; 00080 }; 00081 00082 template<typename _Tp, typename _Distance> 00083 struct bidirectional_iterator { 00084 typedef bidirectional_iterator_tag iterator_category; 00085 typedef _Tp value_type; 00086 typedef _Distance difference_type; 00087 typedef _Tp* pointer; 00088 typedef _Tp& reference; 00089 }; 00090 00091 template<typename _Tp, typename _Distance> 00092 struct random_access_iterator { 00093 typedef random_access_iterator_tag iterator_category; 00094 typedef _Tp value_type; 00095 typedef _Distance difference_type; 00096 typedef _Tp* pointer; 00097 typedef _Tp& reference; 00098 }; 00099 00100 using std::iterator_traits; 00101 00102 template <class _Iter> 00103 inline typename iterator_traits<_Iter>::iterator_category 00104 iterator_category(const _Iter& __i) 00105 { return __iterator_category(__i); } 00106 00107 template <class _Iter> 00108 inline typename iterator_traits<_Iter>::difference_type* 00109 distance_type(const _Iter&) 00110 { return static_cast<typename iterator_traits<_Iter>::difference_type*>(0); } 00111 00112 template<class _Iter> 00113 inline typename iterator_traits<_Iter>::value_type* 00114 value_type(const _Iter& __i) 00115 { return static_cast<typename iterator_traits<_Iter>::value_type*>(0); } 00116 00117 using std::distance; 00118 using __gnu_cxx::distance; // 3-parameter extension 00119 using std::advance; 00120 00121 using std::insert_iterator; 00122 using std::front_insert_iterator; 00123 using std::back_insert_iterator; 00124 using std::inserter; 00125 using std::front_inserter; 00126 using std::back_inserter; 00127 00128 using std::reverse_iterator; 00129 00130 using std::istream_iterator; 00131 using std::ostream_iterator; 00132 00133 // Names from stl_construct.h 00134 template<class _T1, class _T2> 00135 inline void 00136 construct(_T1* __p, const _T2& __value) 00137 { std::_Construct(__p, __value); } 00138 00139 template<class _T1> 00140 inline void 00141 construct(_T1* __p) 00142 { std::_Construct(__p); } 00143 00144 template <class _Tp> 00145 inline void 00146 destroy(_Tp* __pointer) 00147 { std::_Destroy(__pointer); } 00148 00149 template <class _ForwardIterator> 00150 inline void 00151 destroy(_ForwardIterator __first, _ForwardIterator __last) 00152 { std::_Destroy(__first, __last); } 00153 00154 00155 // Names from stl_raw_storage_iter.h 00156 using std::raw_storage_iterator; 00157 00158 #endif /* _CPP_BACKWARD_ITERATOR_H */ 00159 00160 // Local Variables: 00161 // mode:C++ 00162 // End:

Generated on Wed Sep 29 13:54:49 2004 for libstdc++-v3 Source by doxygen 1.3.7