std::execution::read

来自cppreference.com
在标头 <experimental/execution> 定义
execution::sender auto read( auto tag );
(C++26 起)

参数

tag - 以之识别定制点

返回值

返回一个发送器,它联系接收器的环境,并拉出与 tag 所代表的定制点关联的当前值。

示例

read 函数中标签的可能用法,是获取与定制点关联的值。

execution::sender auto get_scheduler()
{
    return read(execution::get_scheduler);
}
 
execution::sender auto get_delegatee_scheduler()
{
    return read(execution::get_delegatee_scheduler);
}
 
execution::sender auto get_allocator()
{
    return read(execution::get_allocator);
}
 
execution::sender auto get_stop_token()
{
    return read(execution::get_stop_token);
}