std::ranges...k_view::size(3)
π NAME π
std::ranges::chunk_view::size - std::ranges::chunk_view::size
okay so welcome to the std::ranges::chunk_view::size page π. The header/manual-name situation is std::ranges...k_view::size(3) from the C++ Standard Libary (yes, βLibaryβ β that's the manual's spelling, not a typo I'm claiming as my own π). We're keeping every fact, just with main-character energy. π
β¨ Synopsis β¨
constexpr auto size() requires ranges::sized_range<V>;
- (1) β since C++23
constexpr auto size() const requires ranges::sized_range<const V>;
- (2) β since C++23
okay so what does it do? It returns the number of elements. That number is the smallest integer value that is not less than the quotient of dividing the size of the underlying view base_ by the underlying data member n_, which holds the number passed to the constructor (0 if default constructed). No cap, it's giving exact div-ceil behavior. Equivalent to:
return __to_unsigned_like(__div_ceil(ranges::distance(base_), n_));
π Parameters π
(none) β zero parameters, bestie. Not a single one. π«Ά
π Return value π
The number of elements. That's the whole return value. Iconic. π
π¦ Example π¦
// Run this code
#include <ranges>
int main()
{
constexpr static auto v = {1, 2, 3, 4, 5};
constexpr auto w{ std::ranges::chunk_view(v, 2) };
static_assert(w.size() == (5 / 2 + (5 % 2 ? 1 : 0)));
}
π See also π
ranges::sizeβ returns an integer equal to the size of a range (C++20) (customization point object)ranges::ssizeβ returns a signed integer equal to the size of a range (C++20) (customization point object)
mwah π β this page came from http://cppreference.com, dated 2024.06.10, and its footer name is std::ranges...k_view::size(3). π«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms