mirror of
https://github.com/Z3Prover/z3
synced 2025-05-09 00:35:47 +00:00
Z3 sources
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f9edad676
commit
e9eab22e5c
1186 changed files with 381859 additions and 0 deletions
68
lib/dec_ref_util.h
Normal file
68
lib/dec_ref_util.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
map_util.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Some goodies for managing reference counters
|
||||
stored in maps.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-06-07
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _MAP_UTIL_H_
|
||||
#define _MAP_UTIL_H_
|
||||
|
||||
/**
|
||||
\brief Decrement the reference counter of the keys and values stored in the map,
|
||||
then reset the map.
|
||||
*/
|
||||
template<typename Mng, typename Map>
|
||||
void dec_ref_key_values(Mng & m, Map & map) {
|
||||
typename Map::iterator it = map.begin();
|
||||
typename Map::iterator end = map.end();
|
||||
for (; it != end; ++it) {
|
||||
m.dec_ref(it->m_key);
|
||||
m.dec_ref(it->m_value);
|
||||
}
|
||||
map.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Decrement the reference counter of the keys stored in the map,
|
||||
then reset the map.
|
||||
*/
|
||||
template<typename Mng, typename Map>
|
||||
void dec_ref_keys(Mng & m, Map & map) {
|
||||
typename Map::iterator it = map.begin();
|
||||
typename Map::iterator end = map.end();
|
||||
for (; it != end; ++it) {
|
||||
m.dec_ref(it->m_key);
|
||||
}
|
||||
map.reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Decrement the reference counter of the values stored in the map,
|
||||
then reset the map.
|
||||
*/
|
||||
template<typename Mng, typename Map>
|
||||
void dec_ref_values(Mng & m, Map & map) {
|
||||
typename Map::iterator it = map.begin();
|
||||
typename Map::iterator end = map.end();
|
||||
for (; it != end; ++it) {
|
||||
m.dec_ref(it->m_value);
|
||||
}
|
||||
map.reset();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue