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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef _LIBCPP___FWD_GET_H 10 #define _LIBCPP___FWD_GET_H 11 12 #include <__concepts/copyable.h> 13 #include <__config> 14 #include <__fwd/array.h> 15 #include <__fwd/pair.h> 16 #include <__fwd/subrange.h> 17 #include <__fwd/tuple.h> 18 #include <__tuple_dir/tuple_element.h> 19 #include <cstddef> 20 21 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 22 # pragma GCC system_header 23 #endif 24 25 _LIBCPP_BEGIN_NAMESPACE_STD 26 27 #ifndef _LIBCPP_CXX03_LANG 28 29 template <size_t _Ip, class ..._Tp> 30 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 31 typename tuple_element<_Ip, tuple<_Tp...> >::type& 32 get(tuple<_Tp...>&) _NOEXCEPT; 33 34 template <size_t _Ip, class ..._Tp> 35 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 36 const typename tuple_element<_Ip, tuple<_Tp...> >::type& 37 get(const tuple<_Tp...>&) _NOEXCEPT; 38 39 template <size_t _Ip, class ..._Tp> 40 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 41 typename tuple_element<_Ip, tuple<_Tp...> >::type&& 42 get(tuple<_Tp...>&&) _NOEXCEPT; 43 44 template <size_t _Ip, class ..._Tp> 45 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 46 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& 47 get(const tuple<_Tp...>&&) _NOEXCEPT; 48 49 #endif //_LIBCPP_CXX03_LANG 50 51 template <size_t _Ip, class _T1, class _T2> 52 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 53 typename tuple_element<_Ip, pair<_T1, _T2> >::type& 54 get(pair<_T1, _T2>&) _NOEXCEPT; 55 56 template <size_t _Ip, class _T1, class _T2> 57 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 58 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& 59 get(const pair<_T1, _T2>&) _NOEXCEPT; 60 61 #ifndef _LIBCPP_CXX03_LANG 62 template <size_t _Ip, class _T1, class _T2> 63 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 64 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& 65 get(pair<_T1, _T2>&&) _NOEXCEPT; 66 67 template <size_t _Ip, class _T1, class _T2> 68 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 69 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& 70 get(const pair<_T1, _T2>&&) _NOEXCEPT; 71 #endif 72 73 template <size_t _Ip, class _Tp, size_t _Size> 74 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 75 _Tp& 76 get(array<_Tp, _Size>&) _NOEXCEPT; 77 78 template <size_t _Ip, class _Tp, size_t _Size> 79 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 80 const _Tp& 81 get(const array<_Tp, _Size>&) _NOEXCEPT; 82 83 #ifndef _LIBCPP_CXX03_LANG 84 template <size_t _Ip, class _Tp, size_t _Size> 85 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 86 _Tp&& 87 get(array<_Tp, _Size>&&) _NOEXCEPT; 88 89 template <size_t _Ip, class _Tp, size_t _Size> 90 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 91 const _Tp&& 92 get(const array<_Tp, _Size>&&) _NOEXCEPT; 93 #endif 94 95 #if _LIBCPP_STD_VER >= 20 96 97 namespace ranges { 98 99 template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> 100 requires((_Index == 0 && copyable<_Iter>) || _Index == 1) 101 _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange); 102 103 template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> 104 requires(_Index < 2) 105 _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange); 106 107 } // namespace ranges 108 109 using ranges::get; 110 111 #endif // _LIBCPP_STD_VER >= 20 112 113 _LIBCPP_END_NAMESPACE_STD 114 115 #endif // _LIBCPP___FWD_GET_H 116