8 std::set
<garbage_collectable
*> gc_items
;
11 garbage_collectable::garbage_collectable()
13 gc_items
.insert(this);
17 garbage_collectable::~garbage_collectable()
22 void garbage_collectable::mark_root()
27 void garbage_collectable::unmark_root()
29 if(root_count
) root_count
--;
32 void garbage_collectable::do_gc()
34 for(auto i
: gc_items
)
36 for(auto i
: gc_items
) {
41 for(auto i
= gc_items
.begin(); i
!= gc_items
.end();) {
42 if(!(*i
)->reachable
) {
51 void garbage_collectable::mark()
53 bool was_reachable
= reachable
;