73 (!std::is_reference_v<T> || (std::is_lvalue_reference_v<T> && std::is_const_v<std::remove_reference_t<T>>));
97 template<
typename Signature>
104 template<
typename... Args>
116 using Clone =
void* (*)(
const void*)
noexcept;
133 m_owner(nullptr, nullptr, nullptr), m_invoke(invoke) {
134 if (!context || !invoke || !clone || !release)
159 m_owner(std::move(other.m_owner)), m_invoke(std::exchange(other.m_invoke,
nullptr)) {}
167 if (
this != &other) {
168 m_owner = std::move(other.m_owner);
169 m_invoke = std::exchange(other.m_invoke,
nullptr);
184 return m_owner.Get() !=
nullptr;
198 return m_invoke(m_owner.Get(), std::forward<Args>(args)...);
220 template<
typename Return,
typename... Args>
221 requires (!std::is_void_v<Return>) && (!std::is_reference_v<Return>) &&
222 Detail::SafeCallbackArgument<Return> && (Detail::SafeCallbackArgument<Args> && ...) &&
224 requires(Return& output, Return&& result) { { output = std::move(result) }
noexcept; }
234 using Clone =
void* (*)(
const void*)
noexcept;
249 m_owner(nullptr, nullptr, nullptr), m_invoke(invoke) {
250 if (!context || !invoke || !clone || !release)
273 m_owner(std::move(other.m_owner)), m_invoke(std::exchange(other.m_invoke,
nullptr)) {}
280 if (
this != &other) {
281 m_owner = std::move(other.m_owner);
282 m_invoke = std::exchange(other.m_invoke,
nullptr);
296 return m_owner.Get() !=
nullptr;
310 Return result(output);
311 const Status status = m_invoke(m_owner.Get(), &result, std::forward<Args>(args)...);
313 output = std::move(result);
344 template<
typename... Args>
345 requires (Safe::Detail::SafeCallbackArgument<Args> && ...) &&
354 template<
typename Return,
typename... Args>
359 requires(Return& output, Return&& value) { { output = std::move(value) }
noexcept; }
Base exception type for the suite.
Definition exception.hxx:67
Opaque unique state and creator-module lifetime callbacks.
Definition owner.hxx:81
bool HasValue() const noexcept
Whether this callback still owns a context.
Definition function.hxx:295
Status Call(Return &output, Args... args) const
Invoke and write a successful result to caller-owned storage.
Definition function.hxx:306
Function & operator=(Function &&other) noexcept
Release current context and transfer.
Definition function.hxx:279
void *(*)(const void *) noexcept Clone
Provider context clone function pointer; null reports failure.
Definition function.hxx:234
Function & operator=(const Function &other)=default
Deep-copy provider context with the strong guarantee.
void(*)(void *) noexcept Release
Provider context destruction function pointer.
Definition function.hxx:238
Function(const Function &other)=default
Deep-copy provider context.
~Function() noexcept=default
Release context through its provider callback.
Function(Function &&other) noexcept
Transfer callback context.
Definition function.hxx:272
Status(*)(void *, Return *, Args...) Invoke
Provider invocation function pointer.
Definition function.hxx:230
Function(void *context, Invoke invoke, Clone clone, Release release)
Adopt provider-owned callback context.
Definition function.hxx:248
Function(void *context, Invoke invoke, Clone clone, Release release)
Adopt provider-owned callback context.
Definition function.hxx:132
void(*)(void *) noexcept Release
Provider context destruction function pointer.
Definition function.hxx:121
Status(*)(void *, Args...) Invoke
Provider invocation function pointer.
Definition function.hxx:111
~Function() noexcept=default
Release context through its provider callback.
Function & operator=(Function &&other) noexcept
Release the current context and transfer another callback.
Definition function.hxx:166
Function & operator=(const Function &other)=default
Deep-copy provider context with the strong guarantee.
bool HasValue() const noexcept
Whether this callback still owns a context.
Definition function.hxx:183
void *(*)(const void *) noexcept Clone
Provider context clone function; null reports failure.
Definition function.hxx:116
Function(Function &&other) noexcept
Transfer callback context.
Definition function.hxx:158
Status Call(Args... args) const
Invoke the provider callback.
Definition function.hxx:194
Function(const Function &other)=default
Deep-copy provider-owned context.
Copyable, creator-context callback with a typed signature.
Definition function.hxx:98
Callback arguments admitted across a DLL boundary.
Definition function.hxx:71
Type that can actually be copy-constructed.
Definition object_semantics.hxx:189
Recognized Safe component after stripping cv and references.
Definition safe.hxx:311
Value permitted in opaque Safe collections.
Definition safe.hxx:409
Owned values that cross a DLL without the caller's CRT.
Status
Result of a collection operation; exceptions never leave its owner callback.
Definition owner.hxx:59
@ Missing
Index or key is absent.
Definition owner.hxx:61
@ Success
Operation completed.
Definition owner.hxx:60
@ Failure
Allocation, copying or comparison failed; no exception crosses the callback.
Definition owner.hxx:62
Named concepts and small type utilities used across the suite.
Root namespace of the StormByte suite.
Recognizes types whose DLL-boundary safety depends on documented provider requirements.
Definition safe.hxx:262
#define STORMBYTE_PUBLIC_TYPE
Definition visibility.h:57