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 pmultiset multiset 35 #define phash_set stdext::hash_set 36 #define phash_multiset stdext::hash_multiset 37 #else // HAVE_STL_HASH 39 #define phash_multiset multiset 40 #endif // HAVE_STL_HASH 42 #else // USE_STL_ALLOCATOR 51 template<
class Key,
class Compare = less<Key> >
52 class pset :
public set<Key, Compare, pallocator_single<Key> > {
55 typedef set<Key, Compare, allocator> base_class;
56 pset(
TypeHandle type_handle = pset_type_handle) : base_class(Compare(), allocator(type_handle)) { }
58 pset(
const Compare &comp,
TypeHandle type_handle = pset_type_handle) : base_class(comp, type_handle) { }
61 std::pair<TYPENAME base_class::iterator, bool>
62 insert(
const TYPENAME base_class::value_type &x) {
63 TAU_PROFILE(
"pset::insert(const value_type &)",
" ", TAU_USER);
64 return base_class::insert(x);
67 TYPENAME base_class::iterator
68 insert(TYPENAME base_class::iterator position,
69 const TYPENAME base_class::value_type &x) {
70 TAU_PROFILE(
"pset::insert(iterator, const value_type &)",
" ", TAU_USER);
71 return base_class::insert(position, x);
75 erase(TYPENAME base_class::iterator position) {
76 TAU_PROFILE(
"pset::erase(iterator)",
" ", TAU_USER);
77 base_class::erase(position);
80 TYPENAME base_class::size_type
81 erase(
const TYPENAME base_class::key_type &x) {
82 TAU_PROFILE(
"pset::erase(const key_type &)",
" ", TAU_USER);
83 return base_class::erase(x);
88 TAU_PROFILE(
"pset::clear()",
" ", TAU_USER);
92 TYPENAME base_class::iterator
93 find(
const TYPENAME base_class::key_type &x) {
94 TAU_PROFILE(
"pset::find(x)",
" ", TAU_USER);
95 return base_class::find(x);
98 TYPENAME base_class::const_iterator
99 find(
const TYPENAME base_class::key_type &x)
const {
100 TAU_PROFILE(
"pset::find(x)",
" ", TAU_USER);
101 return base_class::find(x);
113 template<
class Key,
class Compare = less<Key> >
114 class pmultiset :
public multiset<Key, Compare, pallocator_single<Key> > {
117 pmultiset(
TypeHandle type_handle = pset_type_handle) : multiset<Key, Compare, allocator>(Compare(), allocator(type_handle)) { }
119 pmultiset(
const Compare &comp,
TypeHandle type_handle = pset_type_handle) : multiset<Key, Compare, allocator>(comp, type_handle) { }
130 template<
class Key,
class Compare = method_hash<Key, less<Key> > >
131 class phash_set :
public stdext::hash_set<Key, Compare, pallocator_array<Key> > {
133 phash_set() : stdext::hash_set<Key, Compare, pallocator_array<Key> >() { }
134 phash_set(
const phash_set<Key, Compare> ©) : stdext::hash_set<Key, Compare, pallocator_array<Key> >(copy) { }
135 phash_set(
const Compare &comp) : stdext::hash_set<Key, Compare, pallocator_array<Key> >(comp) { }
145 template<
class Key,
class Compare = method_hash<Key, less<Key> > >
146 class phash_multiset :
public stdext::hash_multiset<Key, Compare, pallocator_array<Key> > {
148 phash_multiset() : stdext::hash_multiset<Key, Compare, pallocator_array<Key> >() { }
149 phash_multiset(
const phash_multiset<Key, Compare> ©) : stdext::hash_multiset<Key, Compare, pallocator_array<Key> >(copy) { }
150 phash_multiset(
const Compare &comp) : stdext::hash_multiset<Key, Compare, pallocator_array<Key> >(comp) { }
153 #else // HAVE_STL_HASH 154 #define phash_set pset 155 #define phash_multiset pmultiset 156 #endif // HAVE_STL_HASH 158 #endif // USE_STL_ALLOCATOR This is our own Panda specialization on the default STL allocator.
This is our own Panda specialization on the default STL multiset.
This is our own Panda specialization on the default STL set.
TypeHandle is the identifier used to differentiate C++ class types.