faio
faio 公共 C++ 接口参考
载入中...
搜索中...
未找到
faio::shared_result< T, S > 模板类 参考

持有共享任务的终态,允许反复借用结果。 更多...

Public 成员函数

const std::conditional_t< std::is_void_v< T >, std::monostate, T > & value () const &
 借用共享结果,若失败则重抛保存的异常。
std::exception_ptr exception () const noexcept
 查询共享任务保存的异常。

详细描述

template<class T, class S = default_scheduler>
class faio::shared_result< T, S >

持有共享任务的终态,允许反复借用结果。

公共头文件
#include <faio/coroutine/composition.hpp>

成员函数说明

◆ value()

template<class T, class S = default_scheduler>
const std::conditional_t< std::is_void_v< T >, std::monostate, T > & faio::shared_result< T, S >::value ( ) const &

借用共享结果,若失败则重抛保存的异常。

返回
返回只读引用,持有该 shared_result 期间有效。

◆ exception()

template<class T, class S = default_scheduler>
std::exception_ptr faio::shared_result< T, S >::exception ( ) const
noexcept

查询共享任务保存的异常。

返回
返回异常指针,成功时为空。