A promise<> provides a mechanism to store a value (or
exception) that can later be retrieved from the corresponding future<> object.
promise<>
and future<>
communicate via their underlying shared state.

#include<boost/fiber/future/promise.hpp>namespaceboost{namespacefibers{template<typenameR>classpromise{public:promise();template<typenameAllocator>promise(std::allocator_arg_t,Allocator);promise(promise&&)noexcept;promise&operator=(promise&&)noexcept;promise(promiseconst&)=delete;promise&operator=(promiseconst&)=delete;~promise();voidswap(promise&)noexcept;future<R>get_future();voidset_value(Rconst&);// member only of generic promise templatevoidset_value(R&&);// member only of generic promise templatevoidset_value(R&);// member only of promise< R & > templatevoidset_value();// member only of promise< void > templatevoidset_exception(std::exception_ptrp);};template<typenameR>voidswap(promise<R>&,promise<R>&)noexcept;}

Destroys *this
and abandons the shared state
if shared state is ready; otherwise stores future_error
with error condition future_errc::broken_promise
as if by promise::set_exception(): the shared
state is set ready.

voidset_value(Rconst&value);// member only of generic promise templatevoidset_value(R&&value);// member only of generic promise templatevoidset_value(R&value);// member only of promise< R & > templatevoidset_value();// member only of promise< void > template