std::ranges::concat_view<Views...>::begin - cppreference.com (original) (raw)

constexpr /*iterator*/<false> begin() requires (!(/*simple-view*/<Views> && ...)); (1) (since C++26)
constexpr /*iterator*/<true> begin() const requires (ranges::range<const Views> && ...) && /*concatable*/<const Views...>; (2) (since C++26)

Returns an iterator to the beginning of the concat_view.

[edit] Return value

As specified above.

[edit] Example

The preliminary version can be checked out on Compiler Explorer.

#include #include 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}"); }

[edit] See also

| | returns an iterator or a sentinel to the end (public member function) [edit] | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | returns an iterator to the beginning of a range(customization point object)[edit] |