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/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_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type& 31 get(tuple<_Tp...>&) _NOEXCEPT; 32 33 template <size_t _Ip, class... _Tp> 34 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type& 35 get(const tuple<_Tp...>&) _NOEXCEPT; 36 37 template <size_t _Ip, class... _Tp> 38 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&& 39 get(tuple<_Tp...>&&) _NOEXCEPT; 40 41 template <size_t _Ip, class... _Tp> 42 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& 43 get(const tuple<_Tp...>&&) _NOEXCEPT; 44 45 #endif //_LIBCPP_CXX03_LANG 46 47 template <size_t _Ip, class _T1, class _T2> 48 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& 49 get(pair<_T1, _T2>&) _NOEXCEPT; 50 51 template <size_t _Ip, class _T1, class _T2> 52 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& 53 get(const pair<_T1, _T2>&) _NOEXCEPT; 54 55 #ifndef _LIBCPP_CXX03_LANG 56 template <size_t _Ip, class _T1, class _T2> 57 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& 58 get(pair<_T1, _T2>&&) _NOEXCEPT; 59 60 template <size_t _Ip, class _T1, class _T2> 61 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& 62 get(const pair<_T1, _T2>&&) _NOEXCEPT; 63 #endif 64 65 template <size_t _Ip, class _Tp, size_t _Size> 66 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT; 67 68 template <size_t _Ip, class _Tp, size_t _Size> 69 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; 70 71 #ifndef _LIBCPP_CXX03_LANG 72 template <size_t _Ip, class _Tp, size_t _Size> 73 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT; 74 75 template <size_t _Ip, class _Tp, size_t _Size> 76 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; 77 #endif 78 79 #if _LIBCPP_STD_VER >= 20 80 81 namespace ranges { 82 83 template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> 84 requires((_Index == 0 && copyable<_Iter>) || _Index == 1) 85 _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange); 86 87 template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> 88 requires(_Index < 2) 89 _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange); 90 91 } // namespace ranges 92 93 using ranges::get; 94 95 #endif // _LIBCPP_STD_VER >= 20 96 97 _LIBCPP_END_NAMESPACE_STD 98 99 #endif // _LIBCPP___FWD_GET_H 100