![]() |
mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
A variant-like class for storing the result of non-void task. More...
#include <task.hpp>
Public Member Functions | |
| constexpr void | set_value (T &&val) noexcept(std::is_nothrow_move_constructible_v< T >) |
| Store result of task. | |
| void | set_exception (std::exception_ptr eptr) noexcept |
| Store exception into the result. | |
| constexpr T | get_value () && |
| Get previously stored result or exception. | |
A variant-like class for storing the result of non-void task.
|
inlineconstexpr |
Get previously stored result or exception.
If this result contains a value, it is returned. Otherwise, if there is an exception stored, it is thrown.
Either set_value or set_exception must be called before calling this.
|
inlinenoexcept |
Store exception into the result.
This can only ve called once and not if set_value was called.
|
inlineconstexprnoexcept |
Store result of task.
This can only ve called once and not if set_exception was called.