std::execution::just
来自 cppreference.cn
| 定义于头文件 <execution> |
||
| struct just_t { /*unspecified*/ }; |
(1) | (C++26 起) |
| inline constexpr just_t just{}; |
(2) | (C++26 起) (定制点对象) |
| 调用签名 (Call signature) |
||
| execution::sender auto just( auto&&... values ); |
(C++26 起) | |
一个发送者工厂,它返回一个通过调用接收器的 set_value() 立即完成的发送者。
设 ts 为一系列子表达式。表达式 just(ts...) 表达式等价于 /*make-sender*/(just, /*product-type*/(ts...))
自定义点对象
名称 execution::just 表示一个*定制点对象*,它是一个 字面量 半规则 类类型的 const 函数对象。其类型经 cv 非限定后的版本是一个标签类型,表示为 execution::just_t。
所有 execution::just_t 的实例都是相等的。在相同参数上调用不同 execution::just_t 类型的实例的效果是等价的,无论表示该实例的表达式是左值还是右值,以及是否 const-qualified(但是,volatile-qualified 的实例不需要是可调用的)。因此,execution::just 可以自由复制,并且其副本可以互换使用。
给定一组类型 Args...,如果 std::declval<Args>()... 满足上述 execution::just 的参数要求,则 execution::just_t 建模:
- std::invocable<execution::just_t, Args...>,
- std::invocable<const execution::just_t, Args...>,
- std::invocable<execution::just_t&, Args...>,以及
- std::invocable<const execution::just_t&, Args...>.
否则,execution::just_t 的任何函数调用运算符都不参与重载决议。
[编辑] 示例
| 本节不完整 原因:无示例 |