1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___TUPLE_TUPLE_ELEMENT_H
10 #define _LIBCPP___TUPLE_TUPLE_ELEMENT_H
12 #include <__cxx03/__config>
13 #include <__cxx03/__tuple/tuple_indices.h>
14 #include <__cxx03/__tuple/tuple_types.h>
15 #include <__cxx03/cstddef>
17 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18 # pragma GCC system_header
21 _LIBCPP_BEGIN_NAMESPACE_STD
23 template <size_t _Ip
, class _Tp
>
24 struct _LIBCPP_TEMPLATE_VIS tuple_element
;
26 template <size_t _Ip
, class _Tp
>
27 struct _LIBCPP_TEMPLATE_VIS tuple_element
<_Ip
, const _Tp
> {
28 typedef _LIBCPP_NODEBUG
const typename tuple_element
<_Ip
, _Tp
>::type type
;
31 template <size_t _Ip
, class _Tp
>
32 struct _LIBCPP_TEMPLATE_VIS tuple_element
<_Ip
, volatile _Tp
> {
33 typedef _LIBCPP_NODEBUG
volatile typename tuple_element
<_Ip
, _Tp
>::type type
;
36 template <size_t _Ip
, class _Tp
>
37 struct _LIBCPP_TEMPLATE_VIS tuple_element
<_Ip
, const volatile _Tp
> {
38 typedef _LIBCPP_NODEBUG
const volatile typename tuple_element
<_Ip
, _Tp
>::type type
;
41 #ifndef _LIBCPP_CXX03_LANG
43 template <size_t _Ip
, class... _Types
>
44 struct _LIBCPP_TEMPLATE_VIS tuple_element
<_Ip
, __tuple_types
<_Types
...> > {
45 static_assert(_Ip
< sizeof...(_Types
), "tuple_element index out of range");
46 typedef _LIBCPP_NODEBUG __type_pack_element
<_Ip
, _Types
...> type
;
49 # if _LIBCPP_STD_VER >= 14
50 template <size_t _Ip
, class... _Tp
>
51 using tuple_element_t _LIBCPP_NODEBUG
= typename tuple_element
<_Ip
, _Tp
...>::type
;
54 #endif // _LIBCPP_CXX03_LANG
56 _LIBCPP_END_NAMESPACE_STD
58 #endif // _LIBCPP___TUPLE_TUPLE_ELEMENT_H