12 #ifndef CPROVER_UTIL_REFERENCE_COUNTING_H
13 #define CPROVER_UTIL_REFERENCE_COUNTING_H
19 template <
typename T, const T &empty = T::blank>
40 #ifdef REFERENCE_COUNTING_DEBUG
41 std::cout <<
"COPY " <<
d <<
" " <<
d->
ref_count <<
'\n';
60 std::swap(other.
d,
d);
103 #ifdef REFERENCE_COUNTING_DEBUG
104 std::cout <<
"COPY " << (&other) <<
"\n";
120 template <
class T, const T &empty>
128 #ifdef REFERENCE_COUNTING_DEBUG
129 std::cout <<
"R: " << old_d <<
" " << old_d->
ref_count <<
'\n';
135 #ifdef REFERENCE_COUNTING_DEBUG
136 std::cout <<
"DELETING " << old_d <<
'\n';
138 std::cout <<
"DEALLOCATING " << old_d <<
"\n";
143 #ifdef REFERENCE_COUNTING_DEBUG
144 std::cout <<
"DONE\n";
149 template <
class T, const T &empty>
152 #ifdef REFERENCE_COUNTING_DEBUG
153 std::cout <<
"DETACH1: " << d <<
'\n';
160 #ifdef REFERENCE_COUNTING_DEBUG
161 std::cout <<
"ALLOCATED " << d <<
'\n';
164 else if(d->ref_count>1)
169 #ifdef REFERENCE_COUNTING_DEBUG
170 std::cout <<
"ALLOCATED " << d <<
'\n';
179 #ifdef REFERENCE_COUNTING_DEBUG
180 std::cout <<
"DETACH2: " << d <<
'\n'
184 template <
class T, const T &empty>
194 template <
class T, const T &empty>
198 {
return !(i1==i2); }
reference_counting(const T &other)
void remove_ref(dt *old_d)
reference_counting & operator=(const reference_counting &other)
void swap(reference_counting &other)
reference_counting(const reference_counting &other)
void copy_from(const reference_counting &other)
bool operator==(const reference_counting< T, empty > &o1, const reference_counting< T, empty > &o2)
bool operator!=(const reference_counting< T, empty > &i1, const reference_counting< T, empty > &i2)
#define PRECONDITION(CONDITION)
#define POSTCONDITION(CONDITION)