std::ranges::lazy_split_view<V,Pattern>::base
来自 cppreference.com
< cpp | ranges | lazy split view
constexpr V base() const& requires std::copy_constructible<V>; |
(1) | (自 C++20) |
constexpr V base() &&; |
(2) | (自 C++20) |
返回底层视图的副本。
1) 从底层视图复制构造结果。
2) 从底层视图移动构造结果。
内容 |
[编辑] 参数
(无)
[编辑] 返回值
底层视图的副本。
[编辑] 示例
运行此代码
#include <iostream> #include <ranges> #include <string_view> void print(std::string_view rem, auto const& r, std::string_view post = "\n") { for (std::cout << rem; auto const& e : r) std::cout << e; std::cout << post; } int main() { constexpr std::string_view keywords{ "this,..throw,..true,..try,.." }; constexpr std::string_view pattern{",.."}; constexpr std::ranges::lazy_split_view lazy_split_view{keywords, pattern}; print("base() = [", lazy_split_view.base(), "]\n" "substrings: "); for (auto const& split: lazy_split_view) print("[", split, "] "); }
输出
base() = [this,..throw,..true,..try,..] substrings: [this] [throw] [true] [try] []
[编辑] 另请参阅
返回底层(已适配)视图的副本 ( std::ranges::split_view<V,Pattern> 的公共成员函数) |