| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
| Member functions | ||||
cartesian_product_view::size | ||||
| Deduction guides | ||||
| Iterator | ||||
| Member functions | ||||
| Non-member functions | ||||
constexpr/* see description */ size() requires/*cartesian-product-is-sized*/<First, Vs...>; | (1) | (since C++23) |
constexpr/* see description */ size()const requires/*cartesian-product-is-sized*/<const First,const Vs...>; | (2) | (since C++23) |
Returns the number of elements. The return type is an implementation-defined/*unsigned-integer-like*/ typeU.
Letbases_ be the underlying tuple of views, andprod be the product of the sizes of all the ranges inbases_.
Equivalent to:
return[&]<std::size_t...Is>(std::index_sequence<Is...>){auto prod=static_cast<U>(1); prod=(static_cast<U>(ranges::size(std::get<Is>(bases_)))* ...);return prod;}(std::make_index_sequence<1U+ sizeof...(Vs)>{});
Contents |
(none)
The number of elements, that is, the product of the sizes of all the underlying ranges.
The return type is the smallest/*unsigned-integer-like*/ type that is sufficiently wide to store the product of the maximum sizes of all the underlying ranges, if such a type exists.
#include <ranges> int main(){constexprstaticauto w={1};constexprstaticauto x={2,3};constexprstaticauto y={4,5,6};constexprstaticauto z={7,8,9,10,11,12,13};constexprauto v= std::ranges::cartesian_product_view(w, x, y, z); static_assert(v.size()== w.size()* x.size()* y.size()* z.size() and v.size()==42);}
(C++20) | returns an integer equal to the size of a range (customization point object)[edit] |
(C++20) | returns a signed integer equal to the size of a range (customization point object)[edit] |