Warning: This file is not a C or C++ file. It does not have highlighting.
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___TUPLE_TUPLE_SIZE_H |
10 | #define _LIBCPP___TUPLE_TUPLE_SIZE_H |
11 | |
12 | #include <__config> |
13 | #include <__cstddef/size_t.h> |
14 | #include <__fwd/tuple.h> |
15 | #include <__tuple/tuple_types.h> |
16 | #include <__type_traits/enable_if.h> |
17 | #include <__type_traits/integral_constant.h> |
18 | #include <__type_traits/is_const.h> |
19 | #include <__type_traits/is_volatile.h> |
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 | template <class _Tp> |
28 | struct tuple_size; |
29 | |
30 | #if !defined(_LIBCPP_CXX03_LANG) |
31 | template <class _Tp, class...> |
32 | using __enable_if_tuple_size_imp _LIBCPP_NODEBUG = _Tp; |
33 | |
34 | template <class _Tp> |
35 | struct tuple_size< |
36 | __enable_if_tuple_size_imp<const _Tp, __enable_if_t<!is_volatile<_Tp>::value>, decltype(tuple_size<_Tp>::value)>> |
37 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; |
38 | |
39 | template <class _Tp> |
40 | struct tuple_size< |
41 | __enable_if_tuple_size_imp<volatile _Tp, __enable_if_t<!is_const<_Tp>::value>, decltype(tuple_size<_Tp>::value)>> |
42 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; |
43 | |
44 | template <class _Tp> |
45 | struct tuple_size<__enable_if_tuple_size_imp<const volatile _Tp, decltype(tuple_size<_Tp>::value)>> |
46 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; |
47 | |
48 | #else |
49 | template <class _Tp> |
50 | struct tuple_size<const _Tp> : public tuple_size<_Tp> {}; |
51 | template <class _Tp> |
52 | struct tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; |
53 | template <class _Tp> |
54 | struct tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; |
55 | #endif |
56 | |
57 | #ifndef _LIBCPP_CXX03_LANG |
58 | |
59 | template <class... _Tp> |
60 | struct tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {}; |
61 | |
62 | template <class... _Tp> |
63 | struct tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {}; |
64 | |
65 | # if _LIBCPP_STD_VER >= 17 |
66 | template <class _Tp> |
67 | inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value; |
68 | # endif |
69 | |
70 | #endif // _LIBCPP_CXX03_LANG |
71 | |
72 | _LIBCPP_END_NAMESPACE_STD |
73 | |
74 | #endif // _LIBCPP___TUPLE_TUPLE_SIZE_H |
75 |
Warning: This file is not a C or C++ file. It does not have highlighting.