std::ranges::concat_view<Views...>::begin
来自cppreference.com
| |
(1) | (C++26 起) |
| |
(2) | (C++26 起) |
返回指向 concat_view 开头的迭代器。
1) 等价于
iterator <false> it(this, std::in_place_index<0>,
ranges::begin(std::get<0>(views_ )));
it.template satisfy <0>();
return it;
2) 等价于
iterator <true> it(this, std::in_place_index<0>,
ranges::begin(std::get<0>(views_ )));
it.template satisfy <0>();
return it;
返回值
如上所述。
示例
运行此代码
#include <print>
#include <ranges>
#include <string_view>
using namespace std::literals;
int main()
{
static constexpr auto c = {"🐱", "🐶"};
static constexpr auto a = {"🤡"sv};
static constexpr auto t = {"💚"sv};
static constexpr auto cat{std::views::concat(c, a, t)};
static_assert(*cat.begin() == "\U0001F431" and
cat.begin()[1] == "🐶" and
*(cat.begin() + 2) == "\N{CLOWN FACE}");
std::println("{}", cat);
}
输出:
["🐱", "🐶", "🤡", "💚"]
参阅
| 返回 指向末尾的迭代器或哨位 (公开成员函数) | |
(C++20) |
返回指向范围起始的迭代器 (定制点对象) |