std::ranges::split_view<V,Pattern>::base
來自 cppreference.com
< cpp | ranges | split_view
constexpr V base() const& requires std::copy_constructible<V>; |
(1) | (C++20 起) |
constexpr V base() &&; |
(2) | (C++20 起) |
返回底層檢視 base_
的副本。
1) 從底層檢視複製構造結果。
2) 從底層檢視移動構造結果。
目錄 |
[編輯] 返回值
1) 底層檢視的副本。
2) 從底層檢視移動構造的檢視。
[編輯] 示例
執行此程式碼
#include <iomanip> #include <iostream> #include <ranges> #include <string_view> int main() { constexpr std::string_view keywords{"this throw true try typedef typeid"}; std::ranges::split_view split_view{keywords, ' '}; std::cout << "base() = " << std::quoted(split_view.base()) << "\n" "substrings: "; for (auto split : split_view) std::cout << std::quoted(std::string_view{split}) << ' '; std::cout << '\n'; }
輸出
base() = "this throw true try typedef typeid" substrings: "this" "throw" "true" "try" "typedef" "typeid"
[編輯] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
---|---|---|---|
LWG 3590 | C++20 | const& 過載還要求複製賦值的有效性 | 約束已放寬 |
[編輯] 參閱
返回底層(適配)檢視的副本 ( std::ranges::lazy_split_view<V,Pattern> 的公開成員函式) |