xo-facet: runtime facet lookup [PROTO]
This commit is contained in:
parent
b1ec26a9fd
commit
fe4fc4a28d
5 changed files with 86 additions and 3 deletions
|
|
@ -78,6 +78,22 @@ namespace xo {
|
|||
memcpy(&(iface_[0]), (void*)&tmp, sizeof(ISpecific));
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime polymorphism:
|
||||
* Create variant for specific interface @p impl
|
||||
* with type-erased data @p data.
|
||||
*
|
||||
* Implements
|
||||
* obj<AFacet>::variant(iface, data)
|
||||
**/
|
||||
OObject(const AFacet * impl, void * data)
|
||||
requires std::is_same_v<DRepr, DVariantPlaceholder>
|
||||
: data_{reinterpret_cast<DVariantPlaceholder*>(data)}
|
||||
{
|
||||
static_assert(sizeof(ISpecific) == sizeof(impl));
|
||||
memcpy(&(iface_[0]), (void*)impl, sizeof(ISpecific));
|
||||
}
|
||||
|
||||
OObject(const OObject & oother) {
|
||||
_launder_from(oother);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue