ORIGINAL
Loading...
Searching...
No Matches
original::async::future< TYPE > Class Template Reference

Represents a future result of an asynchronous computation. More...

#include <async.h>

Collaboration diagram for original::async::future< TYPE >:
Collaboration graph

Public Member Functions

 future (const future &)=delete
 
futureoperator= (const future &)=delete
 
 future (future &&)=default
 
futureoperator= (future &&)=default
 
TYPE result ()
 Gets the result (blocks until ready)
 
bool ready () const
 Checks if the result is ready.
 
std::exception_ptr exception () const noexcept
 Gets the exception if computation failed.
 
void wait ()
 Waits until the result becomes ready.
 

Friends

class async
 

Detailed Description

template<typename TYPE>
class original::async::future< TYPE >

Represents a future result of an asynchronous computation.

Template Parameters
TYPEThe result type of the computation

Provides access to the result of an asynchronous operation. The result can be retrieved only once.

Member Function Documentation

◆ exception()

template<typename TYPE >
std::exception_ptr original::async::future< TYPE >::exception ( ) const
nodiscardnoexcept

Gets the exception if computation failed.

Returns
Exception pointer (nullptr if no exception)

◆ ready()

template<typename TYPE >
bool original::async::future< TYPE >::ready ( ) const
nodiscard

Checks if the result is ready.

Returns
True if result is available

◆ result()

template<typename TYPE >
TYPE original::async::future< TYPE >::result ( )

Gets the result (blocks until ready)

Returns
The computed result
Exceptions
std::exceptionif the computation threw an exception

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