std::ranges...iew::stride(3)

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

πŸ’… std::ranges...iew::stride(3) πŸ’…

okay so bestie, welcome to this lil corner of the C++ Standard Libary β€” yes that's the manual name, and yes we're keeping it exactly as it appears, no edits, periodt πŸ’€βœ¨. This page is about std::ranges::stride_view::stride, and she is lowkey a one-line icon.


🌸 NAME 🌸

  • std::ranges::stride_view::stride β€” std::ranges::stride_view::stride

it's giving same-name energy, and honestly? obsessed 🫢


✨ Synopsis ✨

constexpr ranges::range_difference_t<_Vp> stride() const noexcept;

(since C++23) β€” yes, she's C++23-coded πŸ‘‘

This one returns a copy of the underlying stride object stride_, and it's equivalent to return stride_;. literally that's the whole flex πŸ’…


πŸŽ€ Parameters πŸŽ€

  • (none) β€” zero parameters, not a single one, she takes nothing and still serves 😌

πŸ¦‹ Return value πŸ¦‹

The stride value. that's it, that's the tea β˜•βœ¨


πŸ”₯ Example πŸ”₯

// Run this code

#include <ranges>

int main()
{
    constexpr auto view = std::views::iota(1337)
                        | std::views::stride(42);
    static_assert(view.stride() == 42);
}

bestie this example is a whole vibe check: you build a view by piping std::views::iota(1337) into std::views::stride(42), then static_assert that view.stride() == 42. constexpr confidence, no cap 🌈⭐


mwah πŸ’‹ this has been the std::ranges...iew::stride(3) page, brought to you by the C++ Standard Libary and source/version vibes from http://cppreference.com, dated 2024.06.10 β€” and yup, the footer is also out here repeating std::ranges...iew::stride(3), iconic behavior fr fr πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from