std::span<T,Extent>::data

Returns a pointer to the beginning of the sequence.

# Declarations

constexpr pointer data() const noexcept;

(since C++20)

# Return value

A pointer to the beginning of the sequence.

# Example

#include <iostream>
#include <span>
 
int main()
{
    constexpr char str[] = "ABCDEF\n";
 
    const std::span sp{str};
 
    for (auto n{sp.size()}; n != 2; --n)
        std::cout << sp.last(n).data();
}

# See also