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 #include <bits/cpp_type_traits.h>
00056
00057 _GLIBCXX_BEGIN_NAMESPACE(std)
00058
00059 template<typename _Tp>
00060 class allocator;
00061
00062
00063 template<>
00064 class allocator<void>
00065 {
00066 public:
00067 typedef size_t size_type;
00068 typedef ptrdiff_t difference_type;
00069 typedef void* pointer;
00070 typedef const void* const_pointer;
00071 typedef void value_type;
00072
00073 template<typename _Tp1>
00074 struct rebind
00075 { typedef allocator<_Tp1> other; };
00076 };
00077
00078
00079
00080
00081
00082
00083
00084 template<typename _Tp>
00085 class allocator: public __glibcxx_base_allocator<_Tp>
00086 {
00087 public:
00088 typedef size_t size_type;
00089 typedef ptrdiff_t difference_type;
00090 typedef _Tp* pointer;
00091 typedef const _Tp* const_pointer;
00092 typedef _Tp& reference;
00093 typedef const _Tp& const_reference;
00094 typedef _Tp value_type;
00095
00096 template<typename _Tp1>
00097 struct rebind
00098 { typedef allocator<_Tp1> other; };
00099
00100 allocator() throw() { }
00101
00102 allocator(const allocator& __a) throw()
00103 : __glibcxx_base_allocator<_Tp>(__a) { }
00104
00105 template<typename _Tp1>
00106 allocator(const allocator<_Tp1>&) throw() { }
00107
00108 ~allocator() throw() { }
00109
00110
00111 };
00112
00113 template<typename _T1, typename _T2>
00114 inline bool
00115 operator==(const allocator<_T1>&, const allocator<_T2>&)
00116 { return true; }
00117
00118 template<typename _Tp>
00119 inline bool
00120 operator==(const allocator<_Tp>&, const allocator<_Tp>&)
00121 { return true; }
00122
00123 template<typename _T1, typename _T2>
00124 inline bool
00125 operator!=(const allocator<_T1>&, const allocator<_T2>&)
00126 { return false; }
00127
00128 template<typename _Tp>
00129 inline bool
00130 operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
00131 { return false; }
00132
00133
00134
00135
00136 #if _GLIBCXX_EXTERN_TEMPLATE
00137 extern template class allocator<char>;
00138 extern template class allocator<wchar_t>;
00139 #endif
00140
00141
00142 #undef __glibcxx_base_allocator
00143
00144
00145 template<typename _Alloc, bool = std::__is_empty<_Alloc>::__value>
00146 struct __alloc_swap
00147 { static void _S_do_it(_Alloc&, _Alloc&) { } };
00148
00149 template<typename _Alloc>
00150 struct __alloc_swap<_Alloc, false>
00151 {
00152 static void
00153 _S_do_it(_Alloc& __one, _Alloc& __two)
00154 {
00155
00156 if (__one != __two)
00157 swap(__one, __two);
00158 }
00159 };
00160
00161 _GLIBCXX_END_NAMESPACE
00162
00163 #endif