Lumiera  0.pre.03
del-stash.hpp File Reference

Go to the source code of this file.


Collecting and finally triggering deleter functions.

This building block for custom memory management allows memorising how to kill an object. Frequently, custom allocation schemes have to deal with type erased elements, where the full typed context is only available during construction. When implementing these objects without vtable, we need a reliable way of recalling the correct destructor to invoke. Typically, such entry objects are to be de-allocated in bulk during shutdown, with the possibility to deallocate some objects beforehand explicitly.

The implementation is based on using a vector in a stack-like fashion, thus the deallocation of individual objects might degenerate in performance.

See also
AdviceSystem usage example

Definition in file del-stash.hpp.

#include "lib/error.hpp"
#include "lib/nocopy.hpp"
#include <algorithm>
#include <vector>


class  DelStash
 Manage a collection of deleter functions. More...
class  DelStash::Killer


 Implementation namespace for support and library code.