Sfoglia il codice sorgente

pallocator -> dallocator

David Rose 24 anni fa
parent
commit
b8f3e146ee
2 ha cambiato i file con 12 aggiunte e 10 eliminazioni
  1. 3 8
      dtool/src/dtoolbase/dallocator.T
  2. 9 2
      dtool/src/dtoolbase/dallocator.h

+ 3 - 8
dtool/src/dtoolbase/dallocator.T

@@ -59,25 +59,20 @@ deallocate(void *p, size_t) {
 
 template<class Type>
 INLINE dallocator<Type>::
-dallocator() {
-}
-
-template<class Type>
-INLINE dallocator<Type>::
-dallocator(const allocator<Type> &copy) {
+dallocator() throw() {
 }
 
 template<class Type>
 INLINE dallocator<Type>::pointer dallocator<Type>::
 allocate(dallocator<Type>::size_type n, allocator<void>::const_pointer) {
-  return (dallocator<Type>::pointer)default_operator_new(n * sizeof(Type));
+  return (dallocator<Type>::pointer)(*global_operator_new)(n * sizeof(Type));
 }
 
 template<class Type>
 INLINE void dallocator<Type>::
 //deallocate(dallocator<Type>::pointer p, allocator<Type>::size_type) {
 deallocate(void *p, allocator<Type>::size_type) {
-  default_operator_delete(p);
+  (*global_operator_delete)(p);
 }
 
 #endif  // *_STYLE_ALLOCATOR

+ 9 - 2
dtool/src/dtoolbase/dallocator.h

@@ -78,10 +78,17 @@ public:
 template<class Type>
 class dallocator : public allocator<Type> {
 public:
-  INLINE dallocator();
-  INLINE dallocator(const allocator<Type> &copy);
+  INLINE dallocator() throw();
+
+  // template member functions in VC++ can only be defined in-class.
+  template<class U>
+  INLINE dallocator(const dallocator<U> &copy) throw() { }
+
   INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
   INLINE void deallocate(void *p, size_type n);
+
+  template<class U>
+  struct rebind { typedef dallocator<U> other; };
 };
 
 #else