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