std::span::data(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

okay so this is the manual page for std::span::data from the C++ Standard Library manual, section 3 β€” and yes bestie, it’s literally about getting a pointer to the beginning of a sequence πŸ’…

std::span::data - std::span::data


πŸ› οΈ Synopsis πŸ› οΈ

constexpr pointer data() const noexcept;

(since C++20)

Returns a pointer to the beginning of the sequence. periodt ✨


🎁 Return value 🎁

A pointer to the beginning of the sequence. that’s the whole vibe 🫢


πŸ’» Example πŸ’»

// Run this code

#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

πŸ‘€ See also πŸ‘€

  • constructor β€” constructs a span (public member function)

no cap, that’s the entire page β€” short, sweet, and giving main character energy 🌟

source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::span::data(3) β€” mwah, bye bestie πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from