|
Range primitives | |||||||
|
Range concepts | |||||||||||||||||||
|
Range factories | ||||||||||||||
|
|
Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Helper items | |||||||||||||||||
|
Defined in header <ranges> | ||
template<class T> requiresstd::is_object_v<T> | (1) | (since C++20) |
namespace views{ template<class T> | (2) | (since C++20) |
view
of no elements of a particular type.empty_view
.Contents |
begin [static] | returnsnullptr (public static member function) |
end [static] | returnsnullptr (public static member function) |
data [static] | returnsnullptr (public static member function) |
size [static] | returns0 (public static member function) |
empty [static] | returnstrue (public static member function) |
Inherited fromstd::ranges::view_interface | |
(C++23) | returns a constant iterator to the beginning of the range (public member function of std::ranges::view_interface<D> )[edit] |
(C++23) | returns a sentinel for the constant iterator of the range (public member function of std::ranges::view_interface<D> )[edit] |
returns whether the derived view is not empty, provided only ifranges::empty is applicable to it (public member function of std::ranges::view_interface<D> )[edit] | |
returns the first element in the derived view, provided if it satisfiesforward_range (public member function of std::ranges::view_interface<D> )[edit] | |
returns the last element in the derived view, provided only if it satisfiesbidirectional_range andcommon_range (public member function of std::ranges::view_interface<D> )[edit] | |
returns then th element in the derived view, provided only if it satisfiesrandom_access_range (public member function of std::ranges::view_interface<D> )[edit] |
staticconstexpr T* begin()noexcept{return nullptr;} | (since C++20) | |
empty_view
does not reference any element.
staticconstexpr T* end()noexcept{return nullptr;} | (since C++20) | |
empty_view
does not reference any element.
staticconstexpr T* data()noexcept{return nullptr;} | (since C++20) | |
empty_view
does not reference any element.
staticconstexprstd::size_t size()noexcept{return0;} | (since C++20) | |
empty_view
is always empty.
staticconstexprbool empty()noexcept{returntrue;} | (since C++20) | |
empty_view
is always empty.
template<class T> constexprboolranges::enable_borrowed_range<ranges::empty_view<T>>=true; | (since C++20) | |
This specialization ofranges::enable_borrowed_range makesempty_view
satisfyborrowed_range
.
Althoughempty_view
obtainsfront
,back
, andoperator[] member functions fromview_interface
, calls to them always result in undefined behavior since anempty_view
is always empty.
The inheritedoperatorbool conversion function always returnsfalse.
#include <ranges> int main(){namespace ranges= std::ranges; ranges::empty_view<long> e; static_assert(ranges::empty(e));// uses operator bool static_assert(0== e.size()); static_assert(nullptr== e.data()); static_assert(nullptr== e.begin()); static_assert(nullptr== e.end()); static_assert(nullptr== e.cbegin()); static_assert(nullptr== e.cend());}
(C++17) | a wrapper that may or may not hold an object (class template)[edit] |
aview that contains a single element of a specified value(class template)(customization point object)[edit] | |
(C++20) | aview that includes all elements of arange (alias template)(range adaptor object)[edit] |
(C++20) | aview of the elements of some otherrange (class template)[edit] |