table of contents
| std::ranges::concat_view::begin(3) | C++ Standard Libary | std::ranges::concat_view::begin(3) |
NAME¶
std::ranges::concat_view::begin - std::ranges::concat_view::begin
Synopsis¶
constexpr /*iterator*/<false> begin() (1) (since C++26) requires (!(/*simple-view*/<Views> && ...)); constexpr /*iterator*/<true> begin() const
requires (ranges::range<const Views> && ...) && (2) (since C++26)
/*concatable*/<const Views...>;
Returns an iterator to the beginning of the concat_view.
1) Equivalent to iterator <false> it(this, std::in_place_index<0>, ranges::begin(std::get<0>(views_ ))); it.template satisfy <0>(); return it;. 2) Equivalent to iterator <true> it(this, std::in_place_index<0>, ranges::begin(std::get<0>(views_ ))); it.template satisfy <0>(); return it;.
Return value¶
As specified above.
Example¶
The preliminary version can be checked out on Compiler Explorer.
// Run this code
#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}"); }
See also¶
end returns an iterator or a sentinel to the end
(public member function) ranges::begin returns an iterator to the
beginning of a range (C++20) (customization point object)
| 2026.11.10 | http://cppreference.com |