00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef DALLOCATOR_H
00020 #define DALLOCATOR_H
00021 #include <memory>
00022
00023 #include "dtoolbase.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #if defined(NO_STYLE_ALLOCATOR)
00039
00040
00041
00042 #define dallocator allocator
00043
00044 #elif defined(OLD_STYLE_ALLOCATOR)
00045
00046
00047
00048
00049 template<class Type>
00050 class dallocator : public alloc {
00051 public:
00052 INLINE static Type *allocate(size_t n);
00053 INLINE static void deallocate(void *p, size_t n);
00054 };
00055
00056 #elif defined(GNU_STYLE_ALLOCATOR)
00057
00058
00059
00060 template<class Type>
00061 class dallocator : public allocator<Type> {
00062 public:
00063 INLINE dallocator();
00064 template<class _Tp1>
00065 INLINE dallocator(const dallocator<_Tp1> &other);
00066
00067 INLINE Type *allocate(size_t n);
00068 INLINE void deallocate(void *p, size_t n);
00069
00070 template <class _Tp1> struct rebind {
00071 typedef dallocator<_Tp1> other;
00072 };
00073 };
00074
00075 #elif defined(MODERN_STYLE_ALLOCATOR)
00076
00077
00078 template<class Type>
00079 class dallocator : public allocator<Type> {
00080 public:
00081 INLINE dallocator() throw();
00082
00083
00084 template<class U>
00085 INLINE dallocator(const dallocator<U> ©) throw() { }
00086
00087 INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
00088 INLINE void deallocate(void *p, size_type n);
00089
00090 template<class U> struct rebind {
00091 typedef dallocator<U> other;
00092 };
00093 };
00094
00095 #else
00096 #error Unrecognized allocator symbol defined!
00097 #endif // *_STYLE_ALLOCATOR
00098
00099 #ifndef NO_STYLE_ALLOCATOR
00100 #include "dallocator.T"
00101 #endif
00102
00103 #endif
00104