Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __fwd / get.h
blobd04341496c60dbcc41b7e8bc730764160ad98d97
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 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___FWD_GET_H
10 #define _LIBCPP___FWD_GET_H
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>
21 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22 # pragma GCC system_header
23 #endif
25 _LIBCPP_BEGIN_NAMESPACE_STD
27 #ifndef _LIBCPP_CXX03_LANG
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;
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;
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;
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;
49 #endif //_LIBCPP_CXX03_LANG
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;
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;
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;
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
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;
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;
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;
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
95 #if _LIBCPP_STD_VER >= 20
97 namespace ranges {
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);
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);
107 } // namespace ranges
109 using ranges::get;
111 #endif // _LIBCPP_STD_VER >= 20
113 _LIBCPP_END_NAMESPACE_STD
115 #endif // _LIBCPP___FWD_GET_H