std::ranges::chunk_by_view<V,Pred>:: pred
From cppreference.net
<
cpp
|
ranges
|
chunk by view
C++
Ranges library
|
||||||||||||||||||||||
| Range primitives | |||||||
|
|||||||
| Range concepts | |||||||||||||||||||
|
|||||||||||||||||||
| Range factories | |||||||||
|
|||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||
| Helper items | |||||||||||||||||
|
|
||||||||||||||||
std::ranges::chunk_by_view
| Member functions | ||||
|
chunk_by_view::pred
|
||||
| Deduction guides | ||||
| Iterator | ||||
|
constexpr
const
Pred
&
pred
(
)
const
;
|
(自 C++23 起) | |
返回对所含
Pred
对象的引用。等价于
return
*
pred_
;
。
当
pred_
不包含值时,其行为是未定义的。
参数
(无)
返回值
对所含
Pred
对象的引用。
示例
运行此代码
#include <cassert> #include <concepts> #include <functional> #include <initializer_list> #include <ranges> int main() { const auto v = {1, 1, 2, 2, 1, 1, 1}; auto chunks = v | std::views::chunk_by(std::equal_to{}); auto pred = chunks.pred(); static_assert(std::same_as<decltype(pred), std::equal_to<>>); assert(pred(v.begin()[0], 1)); }