std::span::size_bytes(3)

๐Ÿ“ฆ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

โœจ NAME โœจ

Okay so this page is std::span::size_bytes(3), from the C++ Standard Libary manual, and the name line is literally std::span::size_bytes - std::span::size_bytes. No notes, she said what she said. ๐Ÿ’…

๐ŸŒธ Synopsis ๐ŸŒธ

constexpr size_type size_bytes() const noexcept;  (since C++20)

Returns the size of the sequence in bytes. Thatโ€™s the whole function, bestie. โœจ

๐ŸŽ€ Parameters ๐ŸŽ€

(none) โ€” literally no parameters, she takes zero arguments and thatโ€™s iconic.

๐Ÿฆ‹ Return value ๐Ÿฆ‹

The size of the sequence in bytes, i.e., size() * sizeof(element_type). Math but make it fashion. ๐Ÿงฎ๐Ÿ’–

๐Ÿ’… Example ๐Ÿ’…

       // Run this code

        #include <cstdint>
        #include <span>

        int main()
        {
            constexpr static std::int32_t a[]{1, 2, 3, 4, 5};
            constexpr static std::span s{a};

            static_assert
            (
                sizeof(int32_t) == 4 &&
                std::size(a) == 5 &&
                sizeof a == 20 &&
                s.size() == 5 &&
                s.size_bytes() == 20
            );
        }

๐Ÿš See also ๐Ÿš

  • size โ€” returns the number of elements in the sequence (C++20) (public member function).

source/version: http://cppreference.com ยท date: 2024.06.10 ยท page: std::span::size_bytes(3). byeee bestie, go count some bytes ๐Ÿซถ๐ŸŒˆ

๐Ÿ“ฆ where this page comes from