namespace std::execution {
template<class QueryTag, class ValueType>
struct prop {
QueryTag query_; // exposition only
ValueType value_; // exposition only
constexpr const ValueType& query(QueryTag) const noexcept {
return value_;
}
};
template<class QueryTag, class ValueType>
prop(QueryTag, ValueType) -> prop<QueryTag, unwrap_reference_t<ValueType>>;
}
概要
QueryTag
型クエリオブジェクトのキーとValueType
型の値から、クエリ可能オブジェクトを構築する。
適格要件
説明用のprop-like
テンプレートクラスを用いて、QueryTag
とValueType
がcallable<QueryTag, prop-like<ValueType>>
のモデルであること。
template<class ValueType>
struct prop-like {
const ValueType& query(auto) const noexcept;
};
例
#include <stop_token>
#include <execution>
namespace ex = std::execution;
int main()
{
auto env0 = ex::prop(std::get_stop_token, std::never_stop_token{});
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??