Panda3D
pdeque.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file pdeque.h
10  * @author drose
11  * @date 2001-06-05
12  */
13 
14 #ifndef PDEQUE_H
15 #define PDEQUE_H
16 
17 #include "dtoolbase.h"
18 #include "pallocator.h"
19 #include "register_type.h"
20 #include <deque>
21 
22 
23 #if !defined(USE_STL_ALLOCATOR) || defined(CPPPARSER)
24 // If we're not using custom allocators, just use the standard class
25 // definition.
26 #define pdeque std::deque
27 
28 #else
29 
30 /**
31  * This is our own Panda specialization on the default STL deque. Its main
32  * purpose is to call the hooks for MemoryUsage to properly track STL-
33  * allocated memory.
34  */
35 template<class Type>
36 class pdeque : public std::deque<Type, pallocator_array<Type> > {
37 public:
39  typedef typename std::deque<Type, allocator>::size_type size_type;
40  pdeque(TypeHandle type_handle = pdeque_type_handle) : std::deque<Type, pallocator_array<Type> >(allocator(type_handle)) { }
41  pdeque(size_type n, TypeHandle type_handle = pdeque_type_handle) : std::deque<Type, pallocator_array<Type> >(n, Type(), allocator(type_handle)) { }
42  pdeque(size_type n, const Type &value, TypeHandle type_handle = pdeque_type_handle) : std::deque<Type, pallocator_array<Type> >(n, value, allocator(type_handle)) { }
43 };
44 
45 #endif // USE_STL_ALLOCATOR
46 #endif
This is our own Panda specialization on the default STL deque.
Definition: pdeque.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.