C++: rename component_type to static_vtable

Then there is no reference to "component" in vtable.h
This commit is contained in:
Olivier Goffart 2021-01-14 09:39:21 +01:00
parent 1bcf446078
commit 090039094f
18 changed files with 26 additions and 23 deletions

View file

@ -66,7 +66,7 @@ struct VRcInner {
template<typename VTable_, typename X_> friend class VWeak;
private:
VRcInner() : layout {} {}
const VTable *vtable = &X::component_type;
const VTable *vtable = &X::static_vtable;
int strong_ref = 1;
int weak_ref = 1;
std::uint16_t data_offset = offsetof(VRcInner, data);
@ -108,6 +108,9 @@ public:
new(this) VRc(other);
return *this;
}
/// Construct a new VRc holding an X.
///
/// The type X must have a static member `static_vtable` of type VTable
template<typename ...Args> static VRc make(Args... args) {
auto mem = ::operator new(sizeof(VRcInner<VTable, X>), static_cast<std::align_val_t>(alignof(VRcInner<VTable, X>)));
auto inner = new (mem) VRcInner<VTable, X>;