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" "子字符串: "); for (auto const& split: lazy_split_view) print("[", split, "] "); }
输出:
base() = [this,..throw,..true,..try,..] 子字符串: [this] [throw] [true] [try] []
See 参阅
返回底层(适配的)视图的副本 ( std::ranges::split_view<V,Pattern> 的公开成员函数) |