Path: blob/main/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
35236 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___RANGES_EMPTY_VIEW_H10#define _LIBCPP___RANGES_EMPTY_VIEW_H1112#include <__config>13#include <__ranges/enable_borrowed_range.h>14#include <__ranges/view_interface.h>15#include <__type_traits/is_object.h>16#include <cstddef>1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)19# pragma GCC system_header20#endif2122_LIBCPP_BEGIN_NAMESPACE_STD2324#if _LIBCPP_STD_VER >= 202526namespace ranges {27template <class _Tp>28requires is_object_v<_Tp>29class empty_view : public view_interface<empty_view<_Tp>> {30public:31_LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }32_LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }33_LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }34_LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }35_LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }36};3738template <class _Tp>39inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;4041namespace views {4243template <class _Tp>44inline constexpr empty_view<_Tp> empty{};4546} // namespace views47} // namespace ranges4849#endif // _LIBCPP_STD_VER >= 205051_LIBCPP_END_NAMESPACE_STD5253#endif // _LIBCPP___RANGES_EMPTY_VIEW_H545556