Namespaces
Variants
Actions

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

From cppreference.com
< cpp‎ | container‎ | span
 
C++
 
Containers library
 
std::span
constexpr pointer data() const noexcept;
(since C++20)

Returns a pointer to the beginning of the underlying sequence.

[edit] Return value

data_

[edit] 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();
}

Output:

ABCDEF
BCDEF
CDEF
DEF
EF
F

[edit] See also

constructs a span
(public member function) [edit]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant