Add a dealloc and drop_in_place function to the ComponentVTable

This commit is contained in:
Olivier Goffart 2020-11-06 17:13:01 +01:00
parent 4dbf039425
commit 95c4bac794
9 changed files with 105 additions and 26 deletions

View file

@ -9,6 +9,11 @@
LICENSE END */
#pragma once
#include <cstddef>
#include <new>
namespace vtable {
template<typename T>
struct VRefMut
{
@ -16,6 +21,11 @@ struct VRefMut
void *instance;
};
struct Layout {
std::size_t size;
std::align_val_t align;
};
// For the C++'s purpose, they are all the same
template<typename T>
using VRef = VRefMut<T>;
@ -45,5 +55,8 @@ template<typename Base, typename T, typename Flag = void>
struct VOffset
{
const T *vtable;
uintptr_t offset;
std::uintptr_t offset;
};
}