| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
| Member functions | ||||
zip_transform_view::size | ||||
| Deduction guides | ||||
| Iterator | ||||
| Member functions | ||||
| Non-member functions | ||||
| Sentinel | ||||
| Member functions | ||||
| Non-member functions | ||||
constexprauto size() requiresranges::sized_range</*InnerView*/>; | (1) | (since C++23) |
constexprauto size()const requiresranges::sized_range<const/*InnerView*/> | (2) | (since C++23) |
Returns the number of elements in thezip_transform_view. Provided only if each underlying (adapted) range satisfiessized_range.
zip_.size();.Contents |
(none)
The number of elements, which is the minimum size among all sizes of adaptedviews.
#include <algorithm>#include <cassert>#include <deque>#include <forward_list>#include <functional>#include <iostream>#include <ranges>#include <vector> int main(){auto x=std::vector{1,2,3,4,5};auto y=std::deque<short>{10,20,30};auto z=std::forward_list{100.,200.}; auto v1= std::views::zip_transform(std::plus{}, x, y);assert(v1.size()==std::min(x.size(), y.size()));assert(v1.size()==3);for(int i: v1)std::cout<< i<<' ';std::cout<<'\n'; [[maybe_unused]]auto v2= std::views::zip_transform(std::plus{}, x, z);// auto sz = v2.size(); // Error: z doesn't have size(), so neither does v2 static_assert(not std::ranges::sized_range<decltype(z)>);}
Output:
11 22 33
(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] |