I know Ada quite well but I‘m still struggling with OO in general and specifically in Ada. Thus, it may well be that I‘m simply missing a point.
Consider a data structure like a tree. The objects stored in the tree are of abstract type. I want full control over the deallocation (with Ada.Finalization) because I’m implementing the data structure with safe pointers. This means that on deallocation of the tree, subtrees must not be deallocated when there is still a reference to it.
In this scenario it is required to deallocate the concrete objects referenced in the data structure. It seems to me that this requires an abstract unchecked_deallocation. Is there a simple way to do this? I also considered declaring an abstract Free subroutine that has to be implemented by the instances of the abstract type. Unsuccessful.
In didn’t checked the standard libraries yet for a suitable data structure. Currently I’m just curious about the problem itself.