Namespaces
Variants

std::ranges::chunk_by_view<V,Pred>:: base

From cppreference.net
Ranges library
Range adaptors
constexpr V base ( ) const & requires std:: copy_constructible < V > ;
(1) (C++23以降)
constexpr V base ( ) && ;
(2) (C++23以降)

基になるビュー base_ のコピーを返します。

1) 基になるビューから結果をコピー構築します。以下と同等です: return base_ ;
2) 結果を基になるビューからムーブ構築します。次と同等です: return std :: move ( base_ ) ;

パラメータ

(なし)

戻り値

基になるビューのコピー。

#include <algorithm>
#include <functional>
#include <ranges>
int main()
{
    static constexpr auto v = {1, 1, 2, 2, 3, 3, 3};
    constexpr auto chunks = v | std::views::chunk_by(std::equal_to{});
    static_assert(std::ranges::equal(v, chunks.base()));
}