Browse Source

dtoolbase: Fix issues building with C++20

rdb 4 years ago
parent
commit
4b24ac86a5
2 changed files with 17 additions and 17 deletions
  1. 5 5
      dtool/src/dtoolbase/pallocator.T
  2. 12 12
      dtool/src/dtoolbase/pallocator.h

+ 5 - 5
dtool/src/dtoolbase/pallocator.T

@@ -20,7 +20,7 @@ pallocator_single(TypeHandle type_handle) noexcept :
 
 template<class Type>
 INLINE Type *pallocator_single<Type>::
-allocate(typename pallocator_single<Type>::size_type n, typename std::allocator<void>::const_pointer) {
+allocate(typename pallocator_single<Type>::size_type n, const void *) {
   TAU_PROFILE("pallocator_single:allocate()", " ", TAU_USER);
   // This doesn't support allocating arrays.
   assert(n == 1);
@@ -30,7 +30,7 @@ allocate(typename pallocator_single<Type>::size_type n, typename std::allocator<
 
 template<class Type>
 INLINE void pallocator_single<Type>::
-deallocate(typename pallocator_single<Type>::pointer p, typename pallocator_single<Type>::size_type) {
+deallocate(Type *p, typename pallocator_single<Type>::size_type) {
   TAU_PROFILE("pallocator_single:deallocate()", " ", TAU_USER);
   StaticDeletedChain<Type>::deallocate(p, _type_handle);
 }
@@ -44,13 +44,13 @@ pallocator_array(TypeHandle type_handle) noexcept :
 
 template<class Type>
 INLINE Type *pallocator_array<Type>::
-allocate(typename pallocator_array<Type>::size_type n, typename std::allocator<void>::const_pointer) {
-  return (typename pallocator_array<Type>::pointer)
+allocate(typename pallocator_array<Type>::size_type n, const void *) {
+  return (Type *)
     ASSUME_ALIGNED(_type_handle.allocate_array(n * sizeof(Type)), MEMORY_HOOK_ALIGNMENT);
 }
 
 template<class Type>
 INLINE void pallocator_array<Type>::
-deallocate(typename pallocator_array<Type>::pointer p, typename pallocator_array<Type>::size_type) {
+deallocate(Type *p, typename pallocator_array<Type>::size_type) {
   _type_handle.deallocate_array((void *)p);
 }

+ 12 - 12
dtool/src/dtoolbase/pallocator.h

@@ -46,10 +46,10 @@ class pallocator_single : public std::allocator<Type> {
 public:
   // Nowadays we cannot implicitly inherit typedefs from base classes in a
   // template class; we must explicitly copy them here.
-  typedef typename std::allocator<Type>::pointer pointer;
-  typedef typename std::allocator<Type>::reference reference;
-  typedef typename std::allocator<Type>::const_pointer const_pointer;
-  typedef typename std::allocator<Type>::const_reference const_reference;
+  typedef Type *pointer;
+  typedef Type &reference;
+  typedef const Type *const_pointer;
+  typedef const Type &const_reference;
   typedef typename std::allocator<Type>::size_type size_type;
 
   INLINE pallocator_single(TypeHandle type_handle) noexcept;
@@ -59,9 +59,9 @@ public:
   INLINE pallocator_single(const pallocator_single<U> &copy) noexcept :
     _type_handle(copy._type_handle) { }
 
-  INLINE Type *allocate(size_type n, std::allocator<void>::const_pointer hint = 0)
+  INLINE Type *allocate(size_type n, const void *hint = 0)
     RETURNS_ALIGNED(MEMORY_HOOK_ALIGNMENT);
-  INLINE void deallocate(pointer p, size_type n);
+  INLINE void deallocate(Type *p, size_type n);
 
   template<class U> struct rebind {
     typedef pallocator_single<U> other;
@@ -75,10 +75,10 @@ class pallocator_array : public std::allocator<Type> {
 public:
   // Nowadays we cannot implicitly inherit typedefs from base classes in a
   // template class; we must explicitly copy them here.
-  typedef typename std::allocator<Type>::pointer pointer;
-  typedef typename std::allocator<Type>::reference reference;
-  typedef typename std::allocator<Type>::const_pointer const_pointer;
-  typedef typename std::allocator<Type>::const_reference const_reference;
+  typedef Type *pointer;
+  typedef Type &reference;
+  typedef const Type *const_pointer;
+  typedef const Type &const_reference;
   typedef typename std::allocator<Type>::size_type size_type;
 
   INLINE pallocator_array(TypeHandle type_handle = TypeHandle::none()) noexcept;
@@ -88,9 +88,9 @@ public:
   INLINE pallocator_array(const pallocator_array<U> &copy) noexcept :
     _type_handle(copy._type_handle) { }
 
-  INLINE Type *allocate(size_type n, std::allocator<void>::const_pointer hint = 0)
+  INLINE Type *allocate(size_type n, const void *hint = 0)
     RETURNS_ALIGNED(MEMORY_HOOK_ALIGNMENT);
-  INLINE void deallocate(pointer p, size_type n);
+  INLINE void deallocate(Type *p, size_type n);
 
   template<class U> struct rebind {
     typedef pallocator_array<U> other;