begin,end(std::span) (3) - Linux Manuals

begin,end(std::span): begin,end(std::span)

NAME

begin,end(std::span) - begin,end(std::span)

Synopsis


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.