18 #include "dtoolbase.h"
19 #include "pallocator.h"
20 #include "stl_compares.h"
21 #include "register_type.h"
28 #ifndef USE_STL_ALLOCATOR
32 #define pmultimap multimap
35 #define phash_map stdext::hash_map
36 #define phash_multimap stdext::hash_multimap
37 #else // HAVE_STL_HASH
39 #define phash_multimap multimap
40 #endif // HAVE_STL_HASH
42 #else // USE_STL_ALLOCATOR
51 template<
class Key,
class Value,
class Compare = less<Key> >
52 class pmap :
public map<Key, Value, Compare, pallocator_single<pair<const Key, Value> > > {
55 typedef map<Key, Value, Compare, allocator> base_class;
59 pmap(
const Compare &comp,
TypeHandle type_handle = pmap_type_handle) : base_class(comp,
allocator(type_handle)) { }
62 TYPENAME base_class::mapped_type &
63 operator [] (
const TYPENAME base_class::key_type &k) {
64 TAU_PROFILE(
"pmap::operator [] (const key_type &)",
" ", TAU_USER);
65 return base_class::operator [] (k);
68 std::pair<TYPENAME base_class::iterator, bool>
69 insert(
const TYPENAME base_class::value_type &x) {
70 TAU_PROFILE(
"pmap::insert(const value_type &)",
" ", TAU_USER);
71 return base_class::insert(x);
74 TYPENAME base_class::iterator
75 insert(TYPENAME base_class::iterator position,
76 const TYPENAME base_class::value_type &x) {
77 TAU_PROFILE(
"pmap::insert(iterator, const value_type &)",
" ", TAU_USER);
78 return base_class::insert(position, x);
82 erase(TYPENAME base_class::iterator position) {
83 TAU_PROFILE(
"pmap::erase(iterator)",
" ", TAU_USER);
84 base_class::erase(position);
87 TYPENAME base_class::size_type
88 erase(
const TYPENAME base_class::key_type &x) {
89 TAU_PROFILE(
"pmap::erase(const key_type &)",
" ", TAU_USER);
90 return base_class::erase(x);
95 TAU_PROFILE(
"pmap::clear()",
" ", TAU_USER);
99 TYPENAME base_class::iterator
100 find(
const TYPENAME base_class::key_type &x) {
101 TAU_PROFILE(
"pmap::find(const key_type &)",
" ", TAU_USER);
102 return base_class::find(x);
105 TYPENAME base_class::const_iterator
106 find(
const TYPENAME base_class::key_type &x)
const {
107 TAU_PROFILE(
"pmap::find(const key_type &)",
" ", TAU_USER);
108 return base_class::find(x);
121 template<
class Key,
class Value,
class Compare = less<Key> >
122 class pmultimap :
public multimap<Key, Value, Compare, pallocator_single<pair<const Key, Value> > > {
127 pmultimap(
const Compare &comp,
TypeHandle type_handle = pmap_type_handle) : multimap<Key, Value, Compare, allocator>(comp,
allocator(type_handle)) { }
138 template<
class Key,
class Value,
class Compare = method_hash<Key, less<Key> > >
139 class phash_map :
public stdext::hash_map<Key, Value, Compare, pallocator_array<pair<const Key, Value> > > {
141 phash_map() : stdext::hash_map<Key, Value, Compare,
pallocator_array<pair<const Key, Value> > >() { }
142 phash_map(
const phash_map<Key, Value, Compare> ©) : stdext::hash_map<Key, Value, Compare,
pallocator_array<pair<const Key, Value> > >(copy) { }
143 phash_map(
const Compare &comp) : stdext::hash_map<Key, Value, Compare,
pallocator_array<pair<const Key, Value> > >(comp) { }
153 template<
class Key,
class Value,
class Compare = method_hash<Key, less<Key> > >
154 class phash_multimap :
public stdext::hash_multimap<Key, Value, Compare, pallocator_array<pair<const Key, Value> > > {
156 phash_multimap() : stdext::hash_multimap<Key, Value, Compare,
pallocator_array<pair<const Key, Value> > >() { }
157 phash_multimap(
const phash_multimap<Key, Value, Compare> ©) : stdext::hash_multimap<Key, Value, Compare,
pallocator_array<pair<const Key, Value> > >(copy) { }
158 phash_multimap(
const Compare &comp) : stdext::hash_multimap<Key, Value, Compare,
pallocator_array<pair<const Key, Value> > >(comp) { }
161 #else // HAVE_STL_HASH
162 #define phash_map pmap
163 #define phash_multimap pmultimap
164 #endif // HAVE_STL_HASH
166 #endif // USE_STL_ALLOCATOR
This is our own Panda specialization on the default STL map.
This is our own Panda specialization on the default STL allocator.
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL multimap.