Template Struct init#
Defined in File registry.h
Struct Documentation#
-
template<typename ...Args>
struct init# Helper class to register a constructor method for object types, and (in its zero-argument specialization) an InfoTrait to control whether a field participates in the auto-generated init.
When used with one or more template arguments,
init<Args...>is passed toObjectDef::def()to register an__init__method that constructs an object with the specified argument types:refl::ObjectDef<ExampleObject>() .def(refl::init<int64_t, int32_t>());
When used without template arguments (via CTAD),
init(false)marks a field to be excluded from the auto-generated__ffi_init__constructor, or suppresses auto-init entirely when passed toObjectDef’s constructor:// Per-field opt-out: refl::ObjectDef<Foo>() .def_rw("hidden", &Foo::hidden, refl::init(false), refl::default_value(42)); // Class-level opt-out: refl::ObjectDef<Bar>(refl::init(false)) .def_rw("x", &Bar::x);
Note
The object type is automatically deduced from the
ObjectDefcontext.- Template Parameters:
Args – The argument types for the constructor.
Public Functions
-
constexpr init() noexcept = default#
Constructor.
Friends
- friend class ObjectDef
- friend class OverloadObjectDef