memory 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Filename: allocator
  2. // Created by: drose (12May00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. // This file, and all the other files in this directory, aren't
  15. // intended to be compiled--they're just parsed by CPPParser (and
  16. // interrogate) in lieu of the actual system headers, to generate the
  17. // interrogate database.
  18. #ifndef ALLOCATOR_H
  19. #define ALLOCATOR_H
  20. #include <stdtypedefs.h>
  21. #ifdef GCC_STYLE_ALLOCATOR
  22. class alloc {
  23. public:
  24. static void *allocate(size_t n);
  25. static void deallocate(void *p, size_t n);
  26. };
  27. #else // GCC_STYLE_ALLOCATOR
  28. template<class Type>
  29. class allocator {
  30. public:
  31. typedef Type *pointer;
  32. typedef const Type *const_pointer;
  33. typedef size_t size_type;
  34. INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
  35. INLINE void deallocate(pointer p, size_type n);
  36. };
  37. #endif // GCC_STYLE_ALLOCATOR
  38. #endif