|
welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
|
welder's backend-neutral virtual-slot machinery: which virtual member functions of a type are overridable from the target language, and the bind_flat opt-out marker. More...
#include <cstddef>#include <meta>#include <string_view>#include <vector>#include <welder/diag.hpp>Go to the source code of this file.
Classes | |
| struct | welder::bind_flat_spec |
| The stored form of a bind_flat mark (a plain tag — it carries no state). More... | |
Namespaces | |
| namespace | welder |
| namespace | welder::detail |
| The stored forms of the annotation vocabulary. | |
Functions | |
| consteval bool | welder::bound_flat (std::meta::info entity) |
| Does entity (a type or a member function) carry a bind_flat mark? | |
| consteval bool | welder::is_overridable_virtual (std::meta::info member) |
| Is member an overridable virtual — a virtual member function that welder routes through the trampoline? | |
| consteval bool | welder::detail::same_slot (std::meta::info a, std::meta::info b) |
| Do a and b declare the same vtable slot? | |
| consteval void | welder::detail::collect_virtuals (std::meta::info type, std::vector< std::meta::info > &slots) |
| Accumulate the most-derived declaration of every virtual member function reachable in type's complete object into slots, deduplicating by vtable slot (same_slot — name + parameters + cv/ref, so a covariant override is one slot, not two). | |
| consteval std::vector< std::meta::info > | welder::overridable_virtuals (std::meta::info type) |
| Every overridable virtual slot of type — the ones welder routes through a trampoline — folding in virtuals inherited from any base. | |
| consteval std::meta::info | welder::virtual_slot (std::meta::info type, std::string_view name, std::meta::info fn_type) |
| The overridable virtual slot of type named name whose function type is fn_type — the hand-written disambiguator for an overloaded virtual. | |
| consteval std::size_t | welder::virtual_slot_count (std::meta::info type) |
| The number of overridable virtual member functions of type, inherited ones included. | |
| consteval bool | welder::has_virtual_methods (std::meta::info type) |
| Does type declare or inherit any overridable virtual method? | |
Variables | |
| constexpr bind_flat_spec | welder::bind_flat {} |
| Mark a virtual entity as deliberately bound non-overridably. | |
welder's backend-neutral virtual-slot machinery: which virtual member functions of a type are overridable from the target language, and the bind_flat opt-out marker.
Very different backends consume the same answers: the Python rods route these slots through hand-authored trampolines (the authoring macros and the trampoline registration live in <welder/rods/python/trampoline.hpp>, which re-exports everything here under its historical welder::rods::python spellings), while out-of-tree rods can generate e.g. director subclasses over the identical slot set. Keeping the slot semantics in one place is what makes "overridable" mean the same thing in every language: vtable-slot identity (covariant overrides fold to one slot), inherited virtuals folded in, protected NVI hooks included, private declarations withdrawing their slot, and bind_flat opting a type or method out.
Like the rest of the reflection layer this is header-only, std-<meta> based, and free of any framework dependency.
Definition in file virtuals.hpp.