| (1) | (since C++20) |
| (2) | (since C++20) |
| | |
The default implementation ofsize() member function obtains the size of the range by calculating the difference between the sentinel and the beginning iterator.
[edit]Return value
Following derived types may use the default implementation ofsize():
Following types are derived fromstd::ranges::view_interface and do not declare their ownsize() member function, but they cannot use the default implementation, because their iterator and sentinel types never satisfysized_sentinel_for:
[edit]Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|
| LWG 3646 | C++20 | the default implementations ofsize functions returned a signed type | they return unsigned type |
[edit]See also
| returns the size of a container or array (function template)[edit] |
| returns an integer equal to the size of a range (customization point object)[edit] |
| returns a signed integer equal to the size of a range (customization point object)[edit] |