YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib::Promise< V, E > Class Template Referencefinal

#include <promise.hpp>

Public Member Functions

 Promise (const Promise &other)=delete
 
Promiseoperator= (const Promise &other)=delete
 
 Promise (Promise &&other) noexcept=default
 
Promiseoperator= (Promise &&other) noexcept=default
 
 Promise () noexcept=default
 The default constructor creates not a Valid Promise.
 
 ~Promise () noexcept
 If Promise is Valid then set StopTag.
 
bool Valid () const &noexcept
 Check if this Promise has Future.
 
template<typename... Args>
void Set (Args &&... args) &&
 Set Promise result.
 
 Promise (detail::ResultCorePtr< V, E > core) noexcept
 Part of unsafe but internal API.
 
detail::ResultCorePtr< V, E > & GetCore () noexcept
 

Detailed Description

template<typename V, typename E>
class yaclib::Promise< V, E >

Definition at line 10 of file promise.hpp.

Constructor & Destructor Documentation

◆ Promise() [1/4]

template<typename V , typename E >
yaclib::Promise< V, E >::Promise ( const Promise< V, E > &  other)
delete

◆ Promise() [2/4]

template<typename V , typename E >
yaclib::Promise< V, E >::Promise ( Promise< V, E > &&  other)
defaultnoexcept

◆ Promise() [3/4]

template<typename V , typename E >
yaclib::Promise< V, E >::Promise ( )
defaultnoexcept

The default constructor creates not a Valid Promise.

Needed only for usability, e.g. instead of std::optional<Promise<T>> in containers.

◆ ~Promise()

template<typename V , typename E >
yaclib::Promise< V, E >::~Promise ( )
inlinenoexcept

◆ Promise() [4/4]

template<typename V , typename E >
yaclib::Promise< V, E >::Promise ( detail::ResultCorePtr< V, E core)
inlineexplicitnoexcept

Part of unsafe but internal API.

Definition at line 68 of file promise.hpp.

References yaclib::MakeContract().

Member Function Documentation

◆ GetCore()

template<typename V , typename E >
detail::ResultCorePtr< V, E > & yaclib::Promise< V, E >::GetCore ( )
inlinenoexcept

Definition at line 71 of file promise.hpp.

◆ operator=() [1/2]

template<typename V , typename E >
Promise & yaclib::Promise< V, E >::operator= ( const Promise< V, E > &  other)
delete

◆ operator=() [2/2]

template<typename V , typename E >
Promise & yaclib::Promise< V, E >::operator= ( Promise< V, E > &&  other)
defaultnoexcept

◆ Set()

template<typename V , typename E >
template<typename... Args>
void yaclib::Promise< V, E >::Set ( Args &&...  args) &&
inline

Set Promise result.

Template Parameters
ArgsResult<T> should be constructable from this types
Parameters
argsarguments

Definition at line 54 of file promise.hpp.

References yaclib::detail::Loop(), yaclib::MakeContract(), yaclib::Promise< V, E >::Valid(), and YACLIB_ASSERT.

Referenced by yaclib::Promise< V, E >::~Promise().

◆ Valid()

template<typename V , typename E >
bool yaclib::Promise< V, E >::Valid ( ) const &
inlinenoexcept

Check if this Promise has Future.

Returns
false if this Promise is default-constructed or moved to, otherwise true

Definition at line 43 of file promise.hpp.

Referenced by yaclib::Promise< V, E >::Set(), and yaclib::Promise< V, E >::~Promise().


The documentation for this class was generated from the following file: