iterator.h

00001 // Backward-compat support -*- C++ -*- 00002 00003 // Copyright (C) 2001, 2004 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 2, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // You should have received a copy of the GNU General Public License along 00017 // with this library; see the file COPYING. If not, write to the Free 00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00019 // USA. 00020 00021 // As a special exception, you may use this file as part of a free software 00022 // library without restriction. Specifically, if other files instantiate 00023 // templates or use macros or inline functions from this file, or you compile 00024 // this file and link it with other files to produce an executable, this 00025 // file does not by itself cause the resulting executable to be covered by 00026 // the GNU General Public License. This exception does not however 00027 // invalidate any other reasons why the executable file might be covered by 00028 // the GNU General Public License. 00029 00030 /* 00031 * 00032 * Copyright (c) 1994 00033 * Hewlett-Packard Company 00034 * 00035 * Permission to use, copy, modify, distribute and sell this software 00036 * and its documentation for any purpose is hereby granted without fee, 00037 * provided that the above copyright notice appear in all copies and 00038 * that both that copyright notice and this permission notice appear 00039 * in supporting documentation. Hewlett-Packard Company makes no 00040 * representations about the suitability of this software for any 00041 * purpose. It is provided "as is" without express or implied warranty. 00042 * 00043 * 00044 * Copyright (c) 1996 00045 * Silicon Graphics Computer Systems, Inc. 00046 * 00047 * Permission to use, copy, modify, distribute and sell this software 00048 * and its documentation for any purpose is hereby granted without fee, 00049 * provided that the above copyright notice appear in all copies and 00050 * that both that copyright notice and this permission notice appear 00051 * in supporting documentation. Silicon Graphics makes no 00052 * representations about the suitability of this software for any 00053 * purpose. It is provided "as is" without express or implied warranty. 00054 */ 00055 00056 #ifndef _BACKWARD_ITERATOR_H 00057 #define _BACKWARD_ITERATOR_H 1 00058 00059 #include "backward_warning.h" 00060 #include "function.h" 00061 #include <stddef.h> 00062 #include "iostream.h" 00063 #include <iterator> 00064 00065 #include <bits/stl_construct.h> 00066 #include <bits/stl_raw_storage_iter.h> 00067 00068 #include <ext/iterator> // For 3-parameter distance extension 00069 00070 // Names from stl_iterator.h 00071 using std::input_iterator_tag; 00072 using std::output_iterator_tag; 00073 using std::forward_iterator_tag; 00074 using std::bidirectional_iterator_tag; 00075 using std::random_access_iterator_tag; 00076 00077 #if 0 00078 using std::iterator; 00079 #endif 00080 00081 // The base classes input_iterator, output_iterator, forward_iterator, 00082 // bidirectional_iterator, and random_access_iterator are not part of 00083 // the C++ standard. (They have been replaced by struct iterator.) 00084 // They are included for backward compatibility with the HP STL. 00085 template<typename _Tp, typename _Distance> 00086 struct input_iterator { 00087 typedef input_iterator_tag iterator_category; 00088 typedef _Tp value_type; 00089 typedef _Distance difference_type; 00090 typedef _Tp* pointer; 00091 typedef _Tp& reference; 00092 }; 00093 00094 struct output_iterator { 00095 typedef output_iterator_tag iterator_category; 00096 typedef void value_type; 00097 typedef void difference_type; 00098 typedef void pointer; 00099 typedef void reference; 00100 }; 00101 00102 template<typename _Tp, typename _Distance> 00103 struct forward_iterator { 00104 typedef forward_iterator_tag iterator_category; 00105 typedef _Tp value_type; 00106 typedef _Distance difference_type; 00107 typedef _Tp* pointer; 00108 typedef _Tp& reference; 00109 }; 00110 00111 template<typename _Tp, typename _Distance> 00112 struct bidirectional_iterator { 00113 typedef bidirectional_iterator_tag iterator_category; 00114 typedef _Tp value_type; 00115 typedef _Distance difference_type; 00116 typedef _Tp* pointer; 00117 typedef _Tp& reference; 00118 }; 00119 00120 template<typename _Tp, typename _Distance> 00121 struct random_access_iterator { 00122 typedef random_access_iterator_tag iterator_category; 00123 typedef _Tp value_type; 00124 typedef _Distance difference_type; 00125 typedef _Tp* pointer; 00126 typedef _Tp& reference; 00127 }; 00128 00129 using std::iterator_traits; 00130 00131 template <class _Iter> 00132 inline typename iterator_traits<_Iter>::iterator_category 00133 iterator_category(const _Iter& __i) 00134 { return __iterator_category(__i); } 00135 00136 template <class _Iter> 00137 inline typename iterator_traits<_Iter>::difference_type* 00138 distance_type(const _Iter&) 00139 { return static_cast<typename iterator_traits<_Iter>::difference_type*>(0); } 00140 00141 template<class _Iter> 00142 inline typename iterator_traits<_Iter>::value_type* 00143 value_type(const _Iter& __i) 00144 { return static_cast<typename iterator_traits<_Iter>::value_type*>(0); } 00145 00146 using std::distance; 00147 using __gnu_cxx::distance; // 3-parameter extension 00148 using std::advance; 00149 00150 using std::insert_iterator; 00151 using std::front_insert_iterator; 00152 using std::back_insert_iterator; 00153 using std::inserter; 00154 using std::front_inserter; 00155 using std::back_inserter; 00156 00157 using std::reverse_iterator; 00158 00159 using std::istream_iterator; 00160 using std::ostream_iterator; 00161 00162 // Names from stl_construct.h 00163 template<class _T1, class _T2> 00164 inline void 00165 construct(_T1* __p, const _T2& __value) 00166 { std::_Construct(__p, __value); } 00167 00168 template<class _T1> 00169 inline void 00170 construct(_T1* __p) 00171 { std::_Construct(__p); } 00172 00173 template <class _Tp> 00174 inline void 00175 destroy(_Tp* __pointer) 00176 { std::_Destroy(__pointer); } 00177 00178 template <class _ForwardIterator> 00179 inline void 00180 destroy(_ForwardIterator __first, _ForwardIterator __last) 00181 { std::_Destroy(__first, __last); } 00182 00183 00184 // Names from stl_raw_storage_iter.h 00185 using std::raw_storage_iterator; 00186 00187 #endif /* _BACKWARD_ITERATOR_H */ 00188 00189 // Local Variables: 00190 // mode:C++ 00191 // End:

Generated on Wed Jun 9 11:18:38 2004 for libstdc++-v3 Source by doxygen 1.3.7