Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:40

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___RANGES_EMPTY_VIEW_H
0011 #define _LIBCPP___CXX03___RANGES_EMPTY_VIEW_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__ranges/enable_borrowed_range.h>
0015 #include <__cxx03/__ranges/view_interface.h>
0016 #include <__cxx03/__type_traits/is_object.h>
0017 #include <__cxx03/cstddef>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 #if _LIBCPP_STD_VER >= 20
0026 
0027 namespace ranges {
0028 template <class _Tp>
0029   requires is_object_v<_Tp>
0030 class empty_view : public view_interface<empty_view<_Tp>> {
0031 public:
0032   _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
0033   _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
0034   _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
0035   _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
0036   _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
0037 };
0038 
0039 template <class _Tp>
0040 inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
0041 
0042 namespace views {
0043 
0044 template <class _Tp>
0045 inline constexpr empty_view<_Tp> empty{};
0046 
0047 } // namespace views
0048 } // namespace ranges
0049 
0050 #endif // _LIBCPP_STD_VER >= 20
0051 
0052 _LIBCPP_END_NAMESPACE_STD
0053 
0054 #endif // _LIBCPP___CXX03___RANGES_EMPTY_VIEW_H