00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef _ALLOCATOR_H
00050 #define _ALLOCATOR_H 1
00051
00052
00053 #include <bits/c++allocator.h>
00054
00055 _GLIBCXX_BEGIN_NAMESPACE(std)
00056
00057 template<typename _Tp>
00058 class allocator;
00059
00060
00061 template<>
00062 class allocator<void>
00063 {
00064 public:
00065 typedef size_t size_type;
00066 typedef ptrdiff_t difference_type;
00067 typedef void* pointer;
00068 typedef const void* const_pointer;
00069 typedef void value_type;
00070
00071 template<typename _Tp1>
00072 struct rebind
00073 { typedef allocator<_Tp1> other; };
00074 };
00075
00076
00077
00078
00079
00080
00081
00082 template<typename _Tp>
00083 class allocator: public __glibcxx_base_allocator<_Tp>
00084 {
00085 public:
00086 typedef size_t size_type;
00087 typedef ptrdiff_t difference_type;
00088 typedef _Tp* pointer;
00089 typedef const _Tp* const_pointer;
00090 typedef _Tp& reference;
00091 typedef const _Tp& const_reference;
00092 typedef _Tp value_type;
00093
00094 template<typename _Tp1>
00095 struct rebind
00096 { typedef allocator<_Tp1> other; };
00097
00098 allocator() throw() { }
00099
00100 allocator(const allocator& __a) throw()
00101 : __glibcxx_base_allocator<_Tp>(__a) { }
00102
00103 template<typename _Tp1>
00104 allocator(const allocator<_Tp1>&) throw() { }
00105
00106 ~allocator() throw() { }
00107
00108
00109 };
00110
00111 template<typename _T1, typename _T2>
00112 inline bool
00113 operator==(const allocator<_T1>&, const allocator<_T2>&)
00114 { return true; }
00115
00116 template<typename _Tp>
00117 inline bool
00118 operator==(const allocator<_Tp>&, const allocator<_Tp>&)
00119 { return true; }
00120
00121 template<typename _T1, typename _T2>
00122 inline bool
00123 operator!=(const allocator<_T1>&, const allocator<_T2>&)
00124 { return false; }
00125
00126 template<typename _Tp>
00127 inline bool
00128 operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
00129 { return false; }
00130
00131
00132
00133
00134 #if _GLIBCXX_EXTERN_TEMPLATE
00135 extern template class allocator<char>;
00136 extern template class allocator<wchar_t>;
00137 #endif
00138
00139
00140 #undef __glibcxx_base_allocator
00141
00142
00143 template<typename _Alloc, bool = __is_empty(_Alloc)>
00144 struct __alloc_swap
00145 { static void _S_do_it(_Alloc&, _Alloc&) { } };
00146
00147 template<typename _Alloc>
00148 struct __alloc_swap<_Alloc, false>
00149 {
00150 static void
00151 _S_do_it(_Alloc& __one, _Alloc& __two)
00152 {
00153
00154 if (__one != __two)
00155 swap(__one, __two);
00156 }
00157 };
00158
00159
00160 template<typename _Alloc, bool = __is_empty(_Alloc)>
00161 struct __alloc_neq
00162 {
00163 static bool
00164 _S_do_it(const _Alloc&, const _Alloc&)
00165 { return false; }
00166 };
00167
00168 template<typename _Alloc>
00169 struct __alloc_neq<_Alloc, false>
00170 {
00171 static bool
00172 _S_do_it(const _Alloc& __one, const _Alloc& __two)
00173 { return __one != __two; }
00174 };
00175
00176 _GLIBCXX_END_NAMESPACE
00177
00178 #endif