50 lines · 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//===---------------------------------------------------------------------===//8 9#ifndef _LIBCPP___FWD_SUBRANGE_H10#define _LIBCPP___FWD_SUBRANGE_H11 12#include <__concepts/copyable.h>13#include <__config>14#include <__cstddef/size_t.h>15#include <__iterator/concepts.h>16 17#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif20 21#if _LIBCPP_STD_VER >= 2022 23_LIBCPP_BEGIN_NAMESPACE_STD24 25namespace ranges {26 27enum class subrange_kind : bool { unsized, sized };28 29template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_kind _Kind>30 requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)31class subrange;32 33template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>34 requires((_Index == 0 && copyable<_Iter>) || _Index == 1)35_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>&);36 37template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>38 requires(_Index < 2)39_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&&);40 41} // namespace ranges42 43using ranges::get;44 45_LIBCPP_END_NAMESPACE_STD46 47#endif // _LIBCPP_STD_VER >= 2048 49#endif // _LIBCPP___FWD_SUBRANGE_H50