constexpr pointer data() const noexcept; | (since C++20) |
Returns a pointer to the beginning of the sequence.
A pointer to the beginning of the sequence.
#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();
}Output:
ABCDEF BCDEF CDEF DEF EF F
|
(C++20) | constructs a span (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/container/span/data