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___CONCEPTS_COMMON_WITH_H11#define _LIBCUDACXX___CONCEPTS_COMMON_WITH_H12 13#ifndef __cuda_std__14#include <__config>15#endif //__cuda_std__16 17#include "../__concepts/__concept_macros.h"18#include "../__concepts/common_reference_with.h"19#include "../__concepts/same_as.h"20#include "../__type_traits/add_lvalue_reference.h"21#include "../__type_traits/common_type.h"22#include "../__utility/declval.h"23 24#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)25# pragma GCC system_header26#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)27# pragma clang system_header28#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)29# pragma system_header30#endif // no system header31 32_LIBCUDACXX_BEGIN_NAMESPACE_STD33 34#if _LIBCUDACXX_STD_VER > 1735 36// [concept.common]37 38template<class _Tp, class _Up>39concept common_with =40 same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> &&41 requires {42 static_cast<common_type_t<_Tp, _Up>>(_CUDA_VSTD::declval<_Tp>());43 static_cast<common_type_t<_Tp, _Up>>(_CUDA_VSTD::declval<_Up>());44 } &&45 common_reference_with<46 add_lvalue_reference_t<const _Tp>,47 add_lvalue_reference_t<const _Up>> &&48 common_reference_with<49 add_lvalue_reference_t<common_type_t<_Tp, _Up>>,50 common_reference_t<51 add_lvalue_reference_t<const _Tp>,52 add_lvalue_reference_t<const _Up>>>;53 54#elif _LIBCUDACXX_STD_VER > 1155 56template<class _Tp, class _Up>57_LIBCUDACXX_CONCEPT_FRAGMENT(58 __common_type_exists_,59 requires()(60 typename(common_type_t<_Tp, _Up>),61 typename(common_type_t<_Up, _Tp>)62 ));63 64template<class _Tp, class _Up>65_LIBCUDACXX_CONCEPT _Common_type_exists = _LIBCUDACXX_FRAGMENT(__common_type_exists_, _Tp, _Up);66 67template<class _Tp, class _Up>68_LIBCUDACXX_CONCEPT_FRAGMENT(69 __common_type_constructible_,70 requires()(71 requires(_Common_type_exists<_Tp, _Up>),72 static_cast<common_type_t<_Tp, _Up>>(_CUDA_VSTD::declval<_Tp>()),73 static_cast<common_type_t<_Tp, _Up>>(_CUDA_VSTD::declval<_Up>())74 ));75 76template<class _Tp, class _Up>77_LIBCUDACXX_CONCEPT _Common_type_constructible = _LIBCUDACXX_FRAGMENT(__common_type_constructible_, _Tp, _Up);78 79 80template<class _Tp, class _Up>81_LIBCUDACXX_CONCEPT_FRAGMENT(82 __common_with_,83 requires()(84 requires(_Common_type_constructible<_Tp, _Up>),85 requires(same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>>),86 requires(common_reference_with<87 add_lvalue_reference_t<const _Tp>,88 add_lvalue_reference_t<const _Up>>),89 requires(common_reference_with<90 add_lvalue_reference_t<common_type_t<_Tp, _Up>>,91 common_reference_t<92 add_lvalue_reference_t<const _Tp>,93 add_lvalue_reference_t<const _Up>>>)));94 95template<class _Tp, class _Up>96_LIBCUDACXX_CONCEPT common_with = _LIBCUDACXX_FRAGMENT(__common_with_, _Tp, _Up);97 98#endif // _LIBCUDACXX_STD_VER > 1199 100_LIBCUDACXX_END_NAMESPACE_STD101 102#endif // _LIBCUDACXX___CONCEPTS_COMMON_WITH_H103 