std::ranges::view::empty,std::ranges::empty_view (3) - Linux Manuals
std::ranges::view::empty,std::ranges::empty_view: std::ranges::view::empty,std::ranges::empty_view
NAME
std::ranges::view::empty,std::ranges::empty_view - std::ranges::view::empty,std::ranges::empty_view
Synopsis
template<class T>
requires is_object_v<T> (1) (since C++20)
class empty_view : public view_interface<empty_view<T>>
namespace view {
template<class T> inline constexpr empty_view<T> empty{}; (2) (since C++20)
}
1) A range adaptor that produces a View of no elements of a particular type.
2) Variable template for empty_view.
Member functions
std::ranges::empty_view::begin
static constexpr T* begin() noexcept { return nullptr; }
empty_view does not reference any element.
std::ranges::empty_view::end
static constexpr T* end() noexcept { return nullptr; }
empty_view does not reference any element.
std::ranges::empty_view::data
static constexpr T* data() noexcept { return nullptr; }
empty_view does not reference any element.
std::ranges::empty_view::size
static constexpr std::ptrdiff_t size() noexcept { return 0; }
empty_view is always empty.
std::ranges::empty_view::empty
static constexpr bool empty() noexcept { return true; }
empty_view is always empty.
Non-member functions
begin, end(std::ranges::empty_view)
friend constexpr T* begin(empty_view) noexcept { return nullptr; } (1)
friend constexpr T* end(empty_view) noexcept { return nullptr; } (2)
These functions are not visible to ordinary unqualified or qualified_lookup, and can only be found by argument-dependent_lookup when std::ranges::empty_view<T> is an associated class of the arguments.
Example
// Run this code