sib::monad is a library that provides monadic extensions, with the ability to extend to any type that behaves like a monad - no matter what the syntax.
shared_task is to std::packaged_task what std::shared_future is to std::future. i.e. it exposes the same essential functionality, but through a const interface, and the task is copyable. Furthermore, copies of a shared_task share a common state.
Destructor
Move constructor.
rhs is left in a valid state.
rhs may still share internal state with the constructed shared_task.
Copy constructor.
Shared tasks that are copies of each other share the same internal state.
implicit construction from a packaged_task.
It is Undefined Behaviour to pass a task that has had either its call operator invoked or its future fetched.
explicit construction from an arbitrary callable.
Invoking callable with Args... must return a type convertible to R.
Move assignment operator.
rhs is left in a valid state.
rhs may still share internal state with the constructed shared_task.
Copy assignment operator.
Shared tasks that are copies of each other share the same internal state.
Call operator.
Calling a shared_task will invoke the underlyinging packaged task on the first call. Subsequent calls to the same shared_task, or other shared_tasks that share the same internal state will reuse the same value from before - even if different arguments are supplied.
In all cases, the call operator will not return until the future returned by get_future is ready.
Getter.
Returns a reference to the internal std::shared_future. This is created from the initial packaged_task used in construction. shared_tasks that share the same internal state will return references to the same future.