std::ranges::chunk_by_view<V,Pred>::pred
From cppreference.com
< cpp | ranges | chunk by view
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Ranges library
(C++23)(C++23)
(C++26)(C++26)
(C++23)(C++23)
(C++26)(C++26)
(C++26)(C++26)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
std::ranges::chunk_by_view
chunk_by_view::pred
constexpr const Pred& pred() const;
(since C++23)
Returns a reference to the contained Pred
object. Equivalent to return *pred_
;.
The behavior is undefined if pred_
does not contain a value.
[edit] Parameters
(none)
[edit] Return value
A reference to the contained Pred
object.
[edit] Example
Run this code
#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)); }