std::extents::rank(3)

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

πŸ’– std::extents::rank πŸ’–

okay so welcome to the std::extents::rank(3) page from the C++ Standard Libary manual β€” yes that's the manual name, and we're not fixing it, bestie, we're just vibing πŸ’…βœ¨

🌸 NAME 🌸

std::extents::rank - std::extents::rank

✨ Synopsis ✨

static constexpr rank_type rank() const noexcept;  (since C++23)

it returns the number of dimensions in extents. that's the whole assignment, and it ate. no cap. 🫢

πŸŽ€ Parameters πŸŽ€

  • (none) β€” literally no parameters, bestie; this function takes zero things. πŸ™ˆ

πŸ‘‘ Return value πŸ‘‘

the number of dimensions. periodt. πŸ’…

πŸ¦‹ Example πŸ¦‹

// Run this code

#include <iostream>
#include <mdspan>

int main()
{
    std::extents<int, 1, 2> e1;
    std::extents<int, 3, 4, std::dynamic_extent> e2(5);
    std::cout << e1.rank() << ", " << e2.rank() << '\n';
}

πŸ’€ Output πŸ’€

2, 3

🌈 See also 🌈

  • rank_dynamic β€” returns the dynamic rank of an extents
    • [static] (public static member function)
  • rank β€” obtains the number of dimensions of an array type
    • (C++11) (class template)

πŸ’– source/version check, bestie: http://cppreference.com, 2024.06.10, page std::extents::rank(3) β€” now go slay those dimensions. periodt. βœ¨πŸ’…

πŸ“¦ where this page comes from