Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:05

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___TUPLE_TUPLE_SIZE_H
0010 #define _LIBCPP___TUPLE_TUPLE_SIZE_H
0011 
0012 #include <__config>
0013 #include <__cstddef/size_t.h>
0014 #include <__fwd/tuple.h>
0015 #include <__tuple/tuple_types.h>
0016 #include <__type_traits/enable_if.h>
0017 #include <__type_traits/integral_constant.h>
0018 #include <__type_traits/is_const.h>
0019 #include <__type_traits/is_volatile.h>
0020 
0021 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0022 #  pragma GCC system_header
0023 #endif
0024 
0025 _LIBCPP_BEGIN_NAMESPACE_STD
0026 
0027 template <class _Tp>
0028 struct _LIBCPP_TEMPLATE_VIS tuple_size;
0029 
0030 #if !defined(_LIBCPP_CXX03_LANG)
0031 template <class _Tp, class...>
0032 using __enable_if_tuple_size_imp _LIBCPP_NODEBUG = _Tp;
0033 
0034 template <class _Tp>
0035 struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< const _Tp,
0036                                                                    __enable_if_t<!is_volatile<_Tp>::value>,
0037                                                                    integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
0038     : public integral_constant<size_t, tuple_size<_Tp>::value> {};
0039 
0040 template <class _Tp>
0041 struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< volatile _Tp,
0042                                                                    __enable_if_t<!is_const<_Tp>::value>,
0043                                                                    integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
0044     : public integral_constant<size_t, tuple_size<_Tp>::value> {};
0045 
0046 template <class _Tp>
0047 struct _LIBCPP_TEMPLATE_VIS
0048 tuple_size<__enable_if_tuple_size_imp<const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
0049     : public integral_constant<size_t, tuple_size<_Tp>::value> {};
0050 
0051 #else
0052 template <class _Tp>
0053 struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {};
0054 template <class _Tp>
0055 struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {};
0056 template <class _Tp>
0057 struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
0058 #endif
0059 
0060 #ifndef _LIBCPP_CXX03_LANG
0061 
0062 template <class... _Tp>
0063 struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
0064 
0065 template <class... _Tp>
0066 struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
0067 
0068 #  if _LIBCPP_STD_VER >= 17
0069 template <class _Tp>
0070 inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
0071 #  endif
0072 
0073 #endif // _LIBCPP_CXX03_LANG
0074 
0075 _LIBCPP_END_NAMESPACE_STD
0076 
0077 #endif // _LIBCPP___TUPLE_TUPLE_SIZE_H