1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef _LIBCPP___RANGES_DANGLING_H 11 #define _LIBCPP___RANGES_DANGLING_H 12 13 #include <__config> 14 #include <__ranges/access.h> 15 #include <__ranges/concepts.h> 16 #include <type_traits> 17 18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 19 #pragma GCC system_header 20 #endif 21 22 _LIBCPP_PUSH_MACROS 23 #include <__undef_macros> 24 25 _LIBCPP_BEGIN_NAMESPACE_STD 26 27 #if !defined(_LIBCPP_HAS_NO_RANGES) 28 29 namespace ranges { 30 struct dangling { 31 dangling() = default; 32 _LIBCPP_HIDE_FROM_ABI constexpr dangling(auto&&...) noexcept {} 33 }; 34 35 template <range _Rp> 36 using borrowed_iterator_t = _If<borrowed_range<_Rp>, iterator_t<_Rp>, dangling>; 37 38 // borrowed_subrange_t defined in <__ranges/subrange.h> 39 } // namespace ranges 40 41 #endif // !_LIBCPP_HAS_NO_RANGES 42 43 _LIBCPP_END_NAMESPACE_STD 44 45 _LIBCPP_POP_MACROS 46 47 #endif // _LIBCPP___RANGES_DANGLING_H 48