C++ VBox: make the destructor delete the content in C++

This commit is contained in:
Olivier Goffart 2022-05-27 13:03:55 +02:00 committed by Olivier Goffart
parent 91acbeed92
commit 48f818df62
3 changed files with 21 additions and 16 deletions

View file

@ -26,26 +26,24 @@ struct Layout {
// For the C++'s purpose, they are all the same
template<typename T>
using VRef = VRefMut<T>;
template<typename T>
using VBox = VRefMut<T>;
template<typename T>
using Pin = T;
/*
template<typename T>
struct VBox {
const T *vtable;
void *instance;
const T *vtable = nullptr;
void *instance = nullptr;
VBox(const VBox&) = delete;
VBox() = default;
VBox&operator=(const VBox&) = delete;
~VBox() {
if (vtable && instance) {
vtable->drop({vtable, instance});
}
}
};
template<typename T>
struct VRef {
const T *vtable;
const void *instance;
};
*/
struct AllowPin;
template<typename Base, typename T, typename Flag = void>