codekingpro/portable-devtools
114k
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-exception6// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX___TUPLE_TUPLE_SIZE_H11#define _LIBCUDACXX___TUPLE_TUPLE_SIZE_H12 13#ifndef __cuda_std__14# include <__config>15#endif // __cuda_std__16 17#include "../__fwd/tuple.h"18#include "../__tuple_dir/tuple_types.h"19#include "../__type_traits/enable_if.h"20#include "../__type_traits/integral_constant.h"21#include "../__type_traits/is_const.h"22#include "../__type_traits/is_volatile.h"23#include "../cstddef"24 25#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)26# pragma GCC system_header27#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)28# pragma clang system_header29#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)30# pragma system_header31#endif // no system header32 33_LIBCUDACXX_BEGIN_NAMESPACE_STD34 35template <class _Tp>36struct _LIBCUDACXX_TEMPLATE_VIS tuple_size;37 38template <class _Tp, class...>39using __enable_if_tuple_size_imp = _Tp;40 41template <class _Tp>42struct _LIBCUDACXX_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< const _Tp,43 __enable_if_t<!is_volatile<_Tp>::value>, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>44 : public integral_constant<size_t, tuple_size<_Tp>::value>45{};46 47template <class _Tp>48struct _LIBCUDACXX_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< volatile _Tp,49 __enable_if_t<!is_const<_Tp>::value>, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>50 : public integral_constant<size_t, tuple_size<_Tp>::value>51{};52 53template <class _Tp>54struct _LIBCUDACXX_TEMPLATE_VIS55 tuple_size<__enable_if_tuple_size_imp< const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>56 : public integral_constant<size_t, tuple_size<_Tp>::value>57{};58 59template <class... _Tp>60struct _LIBCUDACXX_TEMPLATE_VIS tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)>61{};62 63template <class... _Tp>64struct _LIBCUDACXX_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)>65{};66 67#if _LIBCUDACXX_STD_VER >= 1768template <class _Tp>69_LIBCUDACXX_INLINE_VAR constexpr size_t tuple_size_v = tuple_size<_Tp>::value;70#endif // _LIBCUDACXX_STD_VER >= 1771 72_LIBCUDACXX_END_NAMESPACE_STD73 74#endif // _LIBCUDACXX___TUPLE_TUPLE_SIZE_H75 