summaryrefslogtreecommitdiff
path: root/src/context/cdlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/context/cdlist.h')
-rw-r--r--src/context/cdlist.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/context/cdlist.h b/src/context/cdlist.h
index dea9f8be7..da101e1a6 100644
--- a/src/context/cdlist.h
+++ b/src/context/cdlist.h
@@ -174,21 +174,28 @@ protected:
<< " data == " << data
<< " call dtor == " << this->d_callDestructor
<< " d_list == " << this->d_list << std::endl;
+ removeLastUntil(((CDList<T, Allocator>*)data)->d_size);
+ Debug("cdlist") << "restore " << this
+ << " level " << this->getContext()->getLevel()
+ << " size back to " << this->d_size
+ << " sizeAlloc at " << this->d_sizeAlloc << std::endl;
+ }
+
+ /** Remove the elements from the given indices to the last.
+ * You should use this function only when you know what you do.
+ */
+ inline void removeLastUntil(const size_t size){
if(this->d_callDestructor) {
- const size_t size = ((CDList<T, Allocator>*)data)->d_size;
while(this->d_size != size) {
--this->d_size;
this->d_allocator.destroy(&this->d_list[this->d_size]);
}
} else {
- this->d_size = ((CDList<T, Allocator>*)data)->d_size;
+ this->d_size = size;
}
- Debug("cdlist") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " size back to " << this->d_size
- << " sizeAlloc at " << this->d_sizeAlloc << std::endl;
}
+
public:
/**
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback