Class DefaultFactory#
Defined in File registry.h
Inheritance Relationships#
Base Type#
public tvm::ffi::reflection::InfoTrait(Struct InfoTrait)
Class Documentation#
-
class DefaultFactory : public tvm::ffi::reflection::InfoTrait#
Trait that can be used to set field default factory.
A default factory is a callable () -> Any that is invoked each time a default value is needed, producing a fresh value. This is important for mutable defaults (e.g., Array, Map) to avoid aliasing.
Public Functions
-
inline explicit DefaultFactory(Function factory)#
Constructor.
- Parameters:
factory – The factory function to be called to produce default values.
-
inline void Apply(TVMFFIFieldInfo *info) const#
Apply the default factory to the field info.
- Parameters:
info – The field info.
-
inline explicit DefaultFactory(Function factory)#