GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::ranges::views::empty,std::ranges::empty_view(3) C++ Standard Libary std::ranges::views::empty,std::ranges::empty_view(3)

std::ranges::views::empty,std::ranges::empty_view - std::ranges::views::empty,std::ranges::empty_view


Defined in header <ranges>
template<class T>


requires std::is_object_v<T> (1) (since C++20)


class empty_view : public ranges::view_interface<empty_view<T>>
namespace views {


template<class T> inline constexpr empty_view<T> empty{}; (2) (since C++20)


}


1) A range factory that produces a view of no elements of a particular type.
2) Variable template for empty_view.


begin returns nullptr
[static] (C++20) (public static member function)
end returns nullptr
[static] (C++20) (public static member function)
data returns nullptr
[static] (C++20) (public static member function)
size returns 0 (zero)
[static] (C++20) (public static member function)
empty returns true
[static] (C++20) (public static member function)
Inherited from std::ranges::view_interface
operator bool Returns whether the derived view is not empty. Provided if
(C++20) ranges::empty is applicable to it.
(public member function of std::ranges::view_interface<D>)
front Returns the first element in the derived view. Provided if it
(C++20) satisfies forward_range.
(public member function of std::ranges::view_interface<D>)
back Returns the last element in the derived view. Provided if it
(C++20) satisfies bidirectional_range and common_range.
(public member function of std::ranges::view_interface<D>)
operator[] Returns the nth element in the derived view. Provided if it
(C++20) satisfies random_access_range.
(public member function of std::ranges::view_interface<D>)

std::ranges::empty_view::begin


static constexpr T* begin() noexcept { return nullptr; } (since C++20)


empty_view does not reference any element.

std::ranges::empty_view::end


static constexpr T* end() noexcept { return nullptr; } (since C++20)


empty_view does not reference any element.

std::ranges::empty_view::data


static constexpr T* data() noexcept { return nullptr; } (since C++20)


empty_view does not reference any element.

std::ranges::empty_view::size


static constexpr std::size_t size() noexcept { return 0; } (since C++20)


empty_view is always empty.

std::ranges::empty_view::empty


static constexpr bool empty() noexcept { return true; } (since C++20)


empty_view is always empty.


Helper templates


template<class T>
inline constexpr bool enable_borrowed_range<ranges::empty_view<T>> = (since C++20)
true;


This specialization of std::ranges::enable_borrowed_range makes empty_view satisfy
borrowed_range.


Although empty_view obtains front, back, and operator[] member functions from
view_interface, calls to them always result in undefined behavior since an
empty_view is always empty.


The inherited operator bool conversion function always returns false.

// Run this code


#include <ranges>


int main()
{
std::ranges::empty_view<long> e;
static_assert(std::ranges::empty(e));
static_assert(0 == e.size());
static_assert(nullptr == e.data());
static_assert(nullptr == e.begin());
static_assert(nullptr == e.end());
}


ranges::single_view a view that contains a single element of a specified value
views::single (class template) (customization point object)
(C++20)
views::all_t a view that includes all elements of a range
views::all (alias template) (range adaptor object)
(C++20)
ranges::ref_view a view of the elements of some other range
(C++20) (class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.