pvector.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Filename: pvector.h
  2. // Created by: drose (05Jun01)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef PVECTOR_H
  19. #define PVECTOR_H
  20. #include <vector>
  21. #include "dtoolbase.h"
  22. #include "pallocator.h"
  23. #ifdef NO_STYLE_ALLOCATOR
  24. // If we're not using custom allocators, just use the standard class
  25. // definition.
  26. #define pvector vector
  27. #else
  28. ////////////////////////////////////////////////////////////////////
  29. // Class : pvector
  30. // Description : This is our own Panda specialization on the default
  31. // STL vector. Its main purpose is to call the hooks
  32. // for MemoryUsage to properly track STL-allocated
  33. // memory.
  34. ////////////////////////////////////////////////////////////////////
  35. template<class Type>
  36. class pvector : public vector<Type, pallocator<Type> > {
  37. public:
  38. pvector() : vector<Type, pallocator<Type> >() { }
  39. pvector(const pvector<Type> &copy) : vector<Type, pallocator<Type> >(copy) { }
  40. pvector(size_type n) : vector<Type, pallocator<Type> >(n) { }
  41. pvector(size_type n, const Type &value) : vector<Type, pallocator<Type> >(n, value) { }
  42. pvector(const Type *begin, const Type *end) : vector<Type, pallocator<Type> >(begin, end) { }
  43. };
  44. #endif // NO_STYLE_ALLOCATOR
  45. #endif