名稱空間
變體
操作

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

來自 cppreference.com
 
 
範圍庫 (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()));
}