9template <
typename V,
typename E>
11 static_assert(
Check<V>(),
"V should be valid");
12 static_assert(
Check<E>(),
"E should be valid");
13 static_assert(!std::is_same_v<V, E>,
"Promise cannot be instantiated with same V and E, because it's ambiguous");
44 return _core !=
nullptr;
53 template <
typename...
Args>
56 if constexpr (
sizeof...(Args) == 0) {
57 _core->Store(std::in_place);
59 _core->Store(std::forward<Args>(
args)...);
61 auto*
core = _core.Release();
A intrusive pointer to objects with an embedded reference count.
Promise() noexcept=default
The default constructor creates not a Valid Promise.
Promise(const Promise &other)=delete
Promise(detail::ResultCorePtr< V, E > core) noexcept
Part of unsafe but internal API.
Promise & operator=(Promise &&other) noexcept=default
Promise & operator=(const Promise &other)=delete
bool Valid() const &noexcept
Check if this Promise has Future.
Promise(Promise &&other) noexcept=default
void Set(Args &&... args) &&
Set Promise result.
detail::ResultCorePtr< V, E > & GetCore() noexcept
#define YACLIB_ASSERT(cond)
YACLIB_INLINE void Loop(InlineCore *prev, InlineCore *curr) noexcept
Contract< V, E > MakeContract()
Creates related future and promise.