| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
constexprauto size() requiresranges::sized_range<V>; | (1) | (since C++20) |
constexprauto size()const requiresranges::sized_range<const V>; | (2) | (since C++20) |
Letbase_ be the underlying view,count_ be the stored count (the number passed to the constructor, or0 if*this is default constructed). Equivalent to
constauto s=ranges::size(base_);
constauto c=static_cast<decltype(s)>(count_);
return s< c?0: s- c;
The number of elements.
#include <array>#include <ranges> int main(){constexprstd::array a{42,43,44}; static_assert( std::ranges::drop_view{std::views::all(a),0}.size()==3&& std::ranges::drop_view{std::views::all(a),1}.size()==2&& std::ranges::drop_view{std::views::all(a),2}.size()==1&& std::ranges::drop_view{std::views::all(a),3}.size()==0&& std::ranges::drop_view{std::views::all(a),4}.size()==0);}
(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] |