| (1) | (since C++20) |
| (2) | (since C++20) |
| | |
The default implementation ofempty()
member function checks whether the object of the derived type's size is0 (if valid), or whether the beginning iterator and the sentinel compare equal.
2) Same as(1), except thatderived isstatic_cast<const D&>(*this).
[edit]Return value
true if the size of the object of the derived type is0 (ifD
satisfiesstd::ranges::sized_range), or its beginning iterator and the sentinel compare equal,false otherwise.
Following derived types may use the default implementation ofempty
:
Althoughstd::ranges::basic_istream_view inherits fromstd::ranges::view_interface and does not declare theempty()
member function, it cannot use the default implementation, because it never satisfies neitherstd::ranges::sized_range norstd::ranges::forward_range.
[edit]Example
[edit]Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
[edit]See also
| checks whether the container is empty (function template)[edit] |
| checks whether a range is empty (customization point object)[edit] |