1bdd1243dSDimitry Andric //===---------------------------------------------------------------------===// 2bdd1243dSDimitry Andric // 3bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6bdd1243dSDimitry Andric // 7bdd1243dSDimitry Andric //===---------------------------------------------------------------------===// 8bdd1243dSDimitry Andric 9bdd1243dSDimitry Andric #ifndef _LIBCPP___FWD_SUBRANGE_H 10bdd1243dSDimitry Andric #define _LIBCPP___FWD_SUBRANGE_H 11bdd1243dSDimitry Andric 12*0fca6ea1SDimitry Andric #include <__concepts/copyable.h> 13bdd1243dSDimitry Andric #include <__config> 14*0fca6ea1SDimitry Andric #include <__iterator/concepts.h> 15*0fca6ea1SDimitry Andric #include <cstddef> 16bdd1243dSDimitry Andric 17bdd1243dSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 18bdd1243dSDimitry Andric # pragma GCC system_header 19bdd1243dSDimitry Andric #endif 20bdd1243dSDimitry Andric 21bdd1243dSDimitry Andric #if _LIBCPP_STD_VER >= 20 22bdd1243dSDimitry Andric 23bdd1243dSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 24bdd1243dSDimitry Andric 25bdd1243dSDimitry Andric namespace ranges { 26bdd1243dSDimitry Andric 275f757f3fSDimitry Andric enum class subrange_kind : bool { unsized, sized }; 28bdd1243dSDimitry Andric 29bdd1243dSDimitry Andric template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_kind _Kind> 30bdd1243dSDimitry Andric requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>) 31bdd1243dSDimitry Andric class _LIBCPP_TEMPLATE_VIS subrange; 32bdd1243dSDimitry Andric 33*0fca6ea1SDimitry Andric template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> 34*0fca6ea1SDimitry Andric requires((_Index == 0 && copyable<_Iter>) || _Index == 1) 35*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>&); 36*0fca6ea1SDimitry Andric 37*0fca6ea1SDimitry Andric template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> 38*0fca6ea1SDimitry Andric requires(_Index < 2) 39*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&&); 40*0fca6ea1SDimitry Andric 41bdd1243dSDimitry Andric } // namespace ranges 42bdd1243dSDimitry Andric 43*0fca6ea1SDimitry Andric using ranges::get; 44*0fca6ea1SDimitry Andric 45bdd1243dSDimitry Andric _LIBCPP_END_NAMESPACE_STD 46bdd1243dSDimitry Andric 47bdd1243dSDimitry Andric #endif // _LIBCPP_STD_VER >= 20 48bdd1243dSDimitry Andric 49bdd1243dSDimitry Andric #endif // _LIBCPP___FWD_SUBRANGE_H 50