std::ranges::take_while_view<V,Pred>::pred
来自 zh.cppreference.net
constexpr const Pred& pred() const;
|
(C++20 起) | |
返回存储谓词的引用 pred_。
如果 *this 未存储谓词(例如对 *this 的赋值抛出异常,导致复制构造或移动构造了某个 Pred),则行为未定义。
参数
(无)
返回值
对存储谓词的引用。
示例
运行此代码
#include <ranges> int main() { static constexpr int a[]{1, 2, 3, 4, 5}; constexpr auto v = a | std::views::take_while([](int x){ return x < 4; }); const auto pred = v.pred(); static_assert(pred(3)); }
参见
|
返回底层(适配的)视图的副本
(公开成员函数) |