|
Library of Assembled Shared Sources
|
Helper class to create PyExportTraits for MaybeNone wrapped types. More...
#include <export_traits.h>

Helper class to create PyExportTraits for MaybeNone wrapped types.
MaybeNone does not provide any runtime or compile-time checks. It only serves to alter the type-hint to T | MaybeNone in Python, which is useful for type-checking, see The Any Trick.
MaybeNone<T> types can only be returned from C++ to Python, it doesn't make sense to pass them as function parameters to C++.
Use this helper to create PyExportTraits for your own MaybeNone wrapped types by inheriting from it.
Built-in specializations are provided for raw pointers T*, util::SharedPtr<T>, std::shared_ptr<T>, and std::optional<T>.
typename T as the main template parameter for your actual type, then the Python type will automatically be deduced. If not, or if you still see a T | None type-hint, you can can override the py_typing member to specify the type-hint you want.Definition at line 695 of file export_traits.h.