11 template <
class K,
class V>
15 typedef typename std::map<K,V*>::iterator it_t;
17 it_t it = a_m.begin();
18 V* entry = (*it).second;
24 template <
class K,
class V>
26 typedef typename std::map<K,V*>::iterator it_t;
29 for(it_t it=a_m.begin();it!=a_m.end();++it) {
30 if((*it).second==a_value) {
40 #ifdef TOOLS_DEPRECATED
41 template <
class K,
class V>
inline void clear(std::map<K,V*>& a_m){safe_clear<K,V>(a_m);}
44 template <
class K,
class V>
45 inline bool delete_key(std::map<K,V*>& a_m,
const K& a_key){
46 typedef typename std::map<K,V*>::iterator it_t;
47 it_t it = a_m.find(a_key);
48 if(it==a_m.end())
return false;
49 V* obj = (*it).second;
55 template <
class K,
class V>
57 typedef typename std::map<K,V*>::iterator it_t;
58 for(it_t it=a_m.begin();it!=a_m.end();++it)
delete (*it).second;
62 template <
class K,
class V>
63 inline void copy(std::map<K,V*>& a_to,
const std::map<K,V*>& a_from){
65 typedef typename std::map<K,V*>::const_iterator it_t;
66 for(it_t it=a_from.begin();it!=a_from.end();++it) {
67 a_to[(*it).first] = (*it).second->copy();
71 template <
class K,
class V>
72 inline bool add_unique(std::map<K,V*>& a_map,
const K& a_key,V* a_value,
bool a_delete) {
73 typedef typename std::map<K,V*>::iterator it_t;
74 it_t it = a_map.find(a_key);
75 if(it==a_map.end()) {a_map[a_key] = a_value;
return false;}
77 V* entry = (*it).second;
81 a_map[a_key] = a_value;
85 template <
class K,
class V>
86 inline bool find(
const std::map<K,V>& a_map,
const K& a_key,V& a_value) {
87 typedef typename std::map<K,V>::const_iterator it_t;
88 it_t it = a_map.find(a_key);
89 if(it==a_map.end()) {a_value = V();
return false;}
90 a_value = (*it).second;
94 template <
class K,
class V>
95 inline bool is_key(
const std::map<K,V>& a_map,
const K& a_key) {
96 typedef typename std::map<K,V>::const_iterator it_t;
97 it_t it = a_map.find(a_key);
98 if(it==a_map.end())
return false;