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()));
}