xo-facet: + builtin _drop() method for poly dtor call
This commit is contained in:
parent
508a061756
commit
24912ffd38
5 changed files with 15 additions and 3 deletions
|
|
@ -27,6 +27,7 @@ set(SELF_LIB xo_facet)
|
|||
xo_add_headeronly_library(${SELF_LIB})
|
||||
|
||||
# note: dependencies here must coordinate with cmake/xo_facetConfig.cmake.in
|
||||
xo_headeronly_dependency(${SELF_LIB} xo_arena)
|
||||
xo_headeronly_dependency(${SELF_LIB} xo_reflectutil)
|
||||
|
||||
xo_install_library4(${SELF_LIB} ${PROJECT_NAME}Targets)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ public:
|
|||
// const methods
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual typeseq _typeseq() const noexcept = 0;
|
||||
/** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/
|
||||
virtual void _drop(Opaque d) const noexcept = 0;
|
||||
{% for md in const_methods %}
|
||||
/** {{md.doc}} **/
|
||||
virtual {{md.return_type}} {{md.name}}({{md.args | args}}) {{md | qualifiers}} = 0;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,11 @@ namespace {{facet_ns2}} {
|
|||
|
||||
// from {{abstract_facet}}
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
[[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); }
|
||||
|
||||
// const methods
|
||||
{% for md in const_methods %}
|
||||
[[noreturn]] {{md.return_type}} {{md.name}}({{md.args | argtypes}}) {{md | qualifiers}} override { _fatal(); }
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,11 @@ namespace {{facet_ns2}} {
|
|||
|
||||
// from {{abstract_facet}}
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); }
|
||||
|
||||
// const methods
|
||||
{% for md in const_methods %}
|
||||
{{md.return_type}} {{md.name}}({{md.args | args}}) {{md | qualifiers}} override {
|
||||
return I::{{md.name}}({{md.args | argnames}});
|
||||
|
|
|
|||
|
|
@ -56,8 +56,11 @@ public:
|
|||
///@{
|
||||
{% endif %}
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
void _drop() const noexcept { O::iface()->_drop(O::data()); }
|
||||
|
||||
// const methods
|
||||
{% for md in const_methods %}
|
||||
{{md.return_type}} {{md.name}}({{md.args | argsnodata}}) {{md | qualifiers}} {
|
||||
return O::iface()->{{md.name}}({{md.args | argrouting}});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue