|
ScL Feature 0.0.1
C++20 composable proxy wrapper with pluggable executor strategy
|
Compile-time property reflection macro for wrapper types. More...
Go to the source code of this file.
Macros | |
| #define | SCL_REFLECT_PROPERTY(prop) |
Generates a wrapper data member that reflects field prop of the wrapped object through the executor. | |
Compile-time property reflection macro for wrapper types.
Provides SCL_REFLECT_PROPERTY to generate a data-member proxy that forwards field access from the enclosing wrapper class to the held object through the executor, preserving cv-ref qualifiers exactly.
SCL_REFLECT_METHOD apply:SCL_REFLECT_PROPERTY: the generated member initializer reads the executor through executor_trait, so the executor subobject has to be constructed first (member initialization follows declaration order).SCL_REFLECT_TYPE(Type, Member) after the executor declaration.scl::feature::executor_trait for the wrapper type.SCL_REFLECT_PROPERTY inside the class body after SCL_REFLECT_TYPE.SCL_REFLECT_PROPERTY exposes a data field (wrapper.prop) rather than a method (wrapper.prop()). Read access uses implicit conversion via wrapper_cast(w.prop); write access uses wrapper_cast(w.prop).to<FieldType&>() for fundamental types, or operator= for class types that provide it.property_<name>(exec cv_ref) member whose first parameter matches a specific cv-ref qualification exactly (detected via a function-pointer cast, the same technique as has_execute_v), property access for that qualification calls the override directly, bypassing execute(). This is analogous to method_<name> overrides in SCL_REFLECT_METHOD.reinterpret_cast (the container_of idiom), which is not a constant expression. Consequently a reflected property member cannot be used in a constant expression, and the enclosing wrapper is not constexpr-constructible while it carries SCL_REFLECT_PROPERTY members.| prop | Unqualified data member name on the wrapped type. |
| #define SCL_REFLECT_PROPERTY | ( | prop | ) |
Generates a wrapper data member that reflects field prop of the wrapped object through the executor.
Expands to a tag struct followed by one data member inside the enclosing class:
execute(). Other qualifications fall through to the execute path. The override must return a type compatible with PropertyType (typically PropertyType&).The inner wrapper's executor (property_execution<ExecutorType, Tag>::holder) stores a signed byte offset from its own address to the outer executor, so memberwise copy and move of the enclosing wrapper work correctly without custom constructors.
| prop | Unqualified data member name on the wrapped type. |