|
| | State () |
| | Default constructor - initializes empty void state.
|
| |
| | ~State () |
| | Destructor - cleanup void state.
|
| |
| void | setValue (std::monostate &&value) |
| | Set completion state for void promise.
|
| |
| void | setException (std::exception_ptr exception) |
| | Set exception state for void promise.
|
| |
| template<typename F > |
| void | setContinuation (std::shared_ptr< SLLooper > &looper_, F &&continuation) |
| | Register continuation callback for void promise completion.
|
| |
| template<typename F > |
| void | setErrorHandler (std::shared_ptr< SLLooper > &looper_, F &&errorHandler) |
| | Register error handler for void promise rejection.
|
| |
Template specialization for void-returning promises.
This specialization handles promises that don't return values (void functions) by using std::monostate as the internal value type. This allows the promise framework to work uniformly with both value-returning and void functions while maintaining type safety.
Key differences from the general template:
- Continuation signature: void() instead of void(tValue)
- Internal value type: std::monostate instead of tValue
- API consistency: Same interface as general template
auto voidState = std::make_shared<State<std::monostate>>();
voidState->setContinuation(looper, []() {
std::cout << "Void promise completed!" << std::endl;
});
voidState->setValue(std::monostate{});
- Note
- Specialization maintains API consistency for void promises
-
std::monostate is a dummy type representing "no value"
- See also
- State, Promise<void>
Definition at line 218 of file State.h.