This is a key element that is not covered by this (although it provides interesting information). My code is as follows:
struct concept { virtual ~concept() = default; }; struct policy { protected : ~policy() = default; }; struct implementation final : concept, policy { };
If I use this hierarchy only with pointers to concept :
unique_ptr<concept> = make_unique<implementation>();
is safe above ?
I believe that if someone tried to delete using the pointer to the policy protected destructor would not allow it (a trick from Modern C++ design ), but does everything else work fine? (namely, when a concept pointer is deleted, are hierarchy destructors guaranteed to be called correctly?)
c ++ c ++ 14
Nikos Athanasiou
source share