W3cubDocs

/C++

begin,end(std::span)

constexpr iterator begin(span s) noexcept;
(1) (since C++20)
constexpr iterator end(span s) noexcept;
(2) (since C++20)
1) Returns an iterator to the first element of the span. Equivalent to s.begin().
2) Returns an iterator to the element following the last element of the span. Equivalent to s.end().

These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::span<T, Extent> is an associated class of the arguments.

Parameters

s - a span

Return value

1) s.begin()
2) s.end()

Notes

These functions are provided to make span rvalues work with std::ranges::begin and std::ranges::end, which reject rvalue arguments by default in order to prevent dangling iterator.

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/container/span/begin_end_nonmem