12 #ifndef CPROVER_UTIL_SHARING_NODE_H 13 #define CPROVER_UTIL_SHARING_NODE_H 20 #define _sn_assert(b) assert(b) 32 class predT=std::equal_to<keyT>,
33 bool no_sharing=
false>
46 typedef std::map<unsigned, self_type>
subt;
50 typedef const std::pair<self_type &, const bool>
find_type;
64 d.k=std::make_shared<key_type>(k);
73 data=std::make_shared<dt>(*other.
data);
77 data=std::make_shared<dt>(*other.
data);
160 typename subt::const_iterator it=s.find(n);
188 for(
const auto &n : c)
211 self_type *
place_leaf(
const key_type &k,
const mapped_type &m)
226 for(
typename containert::const_iterator it=c.begin();
229 const self_type &n=*it;
279 std::shared_ptr<key_type>
k;
280 std::unique_ptr<mapped_type>
m;
302 data=std::make_shared<dt>();
303 else if(
data.use_count()>1)
321 b|=d.k==
nullptr && d.m==
nullptr &&
get_container().empty() &&
324 b|=d.k==
nullptr && d.m==
nullptr && !
get_container().empty() &&
327 b|=d.k!=
nullptr && d.m!=
nullptr &&
get_container().empty() &&
340 template <
class keyT,
class valueT,
class predT,
bool no_sharing>
341 std::shared_ptr<typename sharing_nodet<keyT, valueT, predT, no_sharing>::dt>
345 template <
class keyT,
class valueT,
class predT,
bool no_sharing>
static std::shared_ptr< dt > empty_data
void remove_child(const unsigned n)
bool shares_with(const self_type &other) const
void remove_leaf(const key_type &k)
bool is_well_formed() const
const std::pair< const self_type &, const bool > const_find_type
self_type * place_leaf(const key_type &k, const mapped_type &m)
const self_type * find_leaf(const key_type &k) const
const mapped_type & get_value() const
containert & get_container()
const containert & get_container() const
std::shared_ptr< key_type > k
sharing_nodet(const key_type &k, const mapped_type &m)
static sharing_nodet dummy
bool is_container() const
mapped_type & get_value()
const key_type & get_key() const
self_type * find_leaf(const key_type &k)
sharing_nodet< key_type, mapped_type, key_equal > self_type
sharing_nodet(const self_type &other)
const subt & get_sub() const
self_type * add_child(const unsigned n)
friend void sharing_node_test()
const std::pair< self_type &, const bool > find_type
void swap(self_type &other)
std::shared_ptr< dt > data
std::unique_ptr< mapped_type > m
const self_type * find_child(const unsigned n) const
std::map< unsigned, self_type > subt
std::list< self_type > containert