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

#include <promise.hpp>

Inheritance diagram for yaclib::Promise< V, T >:
[legend]

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::UniqueCorePtr< V, T > core) noexcept
 Part of unsafe but internal API.
 
detail::UniqueCorePtr< V, T > & GetCore () noexcept
 

Detailed Description

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

Definition at line 10 of file promise.hpp.

Constructor & Destructor Documentation

◆ Promise() [1/4]

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

◆ Promise() [2/4]

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

◆ Promise() [3/4]

template<typename V , typename T >
yaclib::Promise< V, T >::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 T >
yaclib::Promise< V, T >::~Promise ( )
inlinenoexcept

◆ Promise() [4/4]

template<typename V , typename T >
yaclib::Promise< V, T >::Promise ( detail::UniqueCorePtr< V, T >  core)
inlineexplicitnoexcept

Part of unsafe but internal API.

Definition at line 68 of file promise.hpp.

Member Function Documentation

◆ GetCore()

template<typename V , typename T >
detail::UniqueCorePtr< V, T > & yaclib::Promise< V, T >::GetCore ( )
inlinenoexcept

Definition at line 71 of file promise.hpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Set()

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

Set Promise result.

Template Parameters
ArgsT::MakeResult<V> should be invocable with this types
Parameters
argsarguments

Definition at line 54 of file promise.hpp.

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

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

◆ Valid()

template<typename V , typename T >
bool yaclib::Promise< V, T >::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, T >::Set(), and yaclib::Promise< V, T >::~Promise().


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