std::ranges::iota_view<W, Bound>::empty
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Ranges library
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++26)(C++26)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)
std::ranges::iota_view
iota_view::empty
constexpr bool empty() const;
(since C++20)
Checks whether the range is empty (i.e. whether the beginning value is the same as the sentinel value).
[edit] Return value
[edit] Example
Run this code
#include <cassert> #include <ranges> int main() { auto a = std::ranges::iota_view <int, int>(); assert (a.empty()); auto b = std::ranges::iota_view (4); assert (!b.empty()); auto c = std::ranges::iota_view (4, 8); assert (!c.empty()); }
[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 4001 | C++20 | the inherited member empty function was not always valid
|
empty is always provided
|
[edit] See also
returns the number of elements, provided only if the underlying (adapted) range satisfies
(public member function) [edit]
sized_range
(public member function) [edit]