| ||||||||||||||||||||||
| 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) |
Returns the number of elements. Equivalent toreturnranges::size(base_);.
The number of elements.
#include <ranges>#include <string_view> int main(){constexprstaticauto v1={1,2,3,4,5};constexprauto common1{v1| std::views::common}; static_assert(common1.size()==5); constexprauto take3{v1| std::views::reverse| std::views::take(3)};constexprauto common2{take3| std::views::common}; static_assert(common2.size()==3); usingnamespace std::literals;constexprstaticauto v2={"∧"sv,"∨"sv,"∃"sv,"∀"sv}; static_assert(std::ranges::views::common(v2).size()==4);}
(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] |