Panda3D
 All Classes Functions Variables Enumerations
pdeque.h
1 // Filename: pdeque.h
2 // Created by: drose (05Jun01)
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 
15 #ifndef PDEQUE_H
16 #define PDEQUE_H
17 
18 #include "dtoolbase.h"
19 #include "pallocator.h"
20 #include "register_type.h"
21 #include <deque>
22 
23 #ifndef USE_STL_ALLOCATOR
24 // If we're not using custom allocators, just use the standard class
25 // definition.
26 #define pdeque deque
27 
28 #else
29 
30 ////////////////////////////////////////////////////////////////////
31 // Class : pdeque
32 // Description : This is our own Panda specialization on the default
33 // STL deque. Its main purpose is to call the hooks
34 // for MemoryUsage to properly track STL-allocated
35 // memory.
36 ////////////////////////////////////////////////////////////////////
37 template<class Type>
38 class pdeque : public deque<Type, pallocator_array<Type> > {
39 public:
41  typedef TYPENAME deque<Type, allocator>::size_type size_type;
42  pdeque(TypeHandle type_handle = pdeque_type_handle) : deque<Type, pallocator_array<Type> >(allocator(type_handle)) { }
43  pdeque(const pdeque<Type> &copy) : deque<Type, pallocator_array<Type> >(copy) { }
44  pdeque(size_type n, TypeHandle type_handle = pdeque_type_handle) : deque<Type, pallocator_array<Type> >(n, Type(), allocator(type_handle)) { }
45  pdeque(size_type n, const Type &value, TypeHandle type_handle = pdeque_type_handle) : deque<Type, pallocator_array<Type> >(n, value, allocator(type_handle)) { }
46 };
47 
48 #endif // USE_STL_ALLOCATOR
49 #endif
This is our own Panda specialization on the default STL deque.
Definition: pdeque.h:38
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85