Skip to content

[super! 4/6] Reach super metadata by conversion - #71

Open
mingxwa wants to merge 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/super-stage4
Open

[super! 4/6] Reach super metadata by conversion#71
mingxwa wants to merge 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/super-stage4

Conversation

@mingxwa

@mingxwa mingxwa commented Aug 31, 2026

Copy link
Copy Markdown
Member

meta_storage looked a meta up with get<M>(), which resolved to a static_cast over a flat set of base classes. That works only while every meta is a direct base of the storage, and cannot reach a meta held inside an aggregate.

Replace it with proxy_meta, whose contained metas are reached through a conversion operator. A meta is contained if the metadata converts to it without throwing, so an aggregate that itself converts to a meta makes that meta reachable too. unique_types_t reduces the meta list so that each entry is contained by exactly one entry, namely itself, which is the property that keeps the conversion unambiguous: a duplicate collapses onto its leftmost occurrence, and a meta subsumed by an aggregate is replaced by that aggregate in place.

Both storages now expose the metadata through operator*, so choosing between them is independent of how a meta is looked up. static_meta_storage holds a single meta and is chosen by size rather than by shape, which separates the metadata layout from the decision to hold it out of line. Under pointer authentication, assigning one storage from another signs a raw pointer, which meta_ptr now supports.

meta_storage looked a meta up with get<M>(), which resolved to a
static_cast over a flat set of base classes. That works only while every
meta is a direct base of the storage, and cannot reach a meta held
inside an aggregate.

Replace it with proxy_meta, whose contained metas are reached through a
conversion operator. A meta is contained if the metadata converts to it
without throwing, so an aggregate that itself converts to a meta makes
that meta reachable too. unique_types_t reduces the meta list so that
each entry is contained by exactly one entry, namely itself, which is
the property that keeps the conversion unambiguous: a duplicate
collapses onto its leftmost occurrence, and a meta subsumed by an
aggregate is replaced by that aggregate in place.

Both storages now expose the metadata through operator*, so choosing
between them is independent of how a meta is looked up.
static_meta_storage holds a single meta and is chosen by size rather
than by shape, which separates the metadata layout from the decision to
hold it out of line. Under pointer authentication, assigning one storage
from another signs a raw pointer, which meta_ptr now supports.

No functional change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant