Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
constructible.h126 linesDownload Raw Back to __concepts
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_CONSTRUCTIBLE_H11#define _LIBCUDACXX___CONCEPTS_CONSTRUCTIBLE_H12 13#ifndef __cuda_std__14#include <__config>15#endif //__cuda_std__16 17#include "../__concepts/__concept_macros.h"18#include "../__concepts/convertible_to.h"19#include "../__concepts/destructible.h"20#include "../__type_traits/add_lvalue_reference.h"21#include "../__type_traits/is_constructible.h"22 23#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)24#  pragma GCC system_header25#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)26#  pragma clang system_header27#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)28#  pragma system_header29#endif // no system header30 31_LIBCUDACXX_BEGIN_NAMESPACE_STD32 33#if _LIBCUDACXX_STD_VER > 1734 35// [concept.constructible]36template<class _Tp, class... _Args>37concept constructible_from =38    destructible<_Tp> && is_constructible_v<_Tp, _Args...>;39 40// [concept.default.init]41template<class _Tp>42concept __default_initializable = requires { ::new _Tp; };43 44template<class _Tp>45concept default_initializable = constructible_from<_Tp> &&46    requires { _Tp{}; } && __default_initializable<_Tp>;47 48// [concept.moveconstructible]49template<class _Tp>50concept move_constructible =51  constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;52 53// [concept.copyconstructible]54template<class _Tp>55concept copy_constructible =56  move_constructible<_Tp> &&57  constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&58  constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&59  constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;60 61#elif _LIBCUDACXX_STD_VER > 1162 63template<class _Tp, class... _Args>64_LIBCUDACXX_CONCEPT_FRAGMENT(65  __constructible_from_,66  requires()(67    requires(destructible<_Tp>),68    requires(_LIBCUDACXX_TRAIT(is_constructible, _Tp, _Args...))69  ));70 71template<class _Tp, class... _Args>72_LIBCUDACXX_CONCEPT constructible_from = _LIBCUDACXX_FRAGMENT(__constructible_from_, _Tp, _Args...);73 74template<class _Tp>75_LIBCUDACXX_CONCEPT_FRAGMENT(76  __default_initializable_,77  requires()(78    (::new _Tp)79  ));80 81template<class _Tp>82_LIBCUDACXX_CONCEPT __default_initializable = _LIBCUDACXX_FRAGMENT(__default_initializable_, _Tp);83 84template<class _Tp>85_LIBCUDACXX_CONCEPT_FRAGMENT(86  _Default_initializable_,87  requires(_Tp = _Tp{}) (88    requires(constructible_from<_Tp>),89    requires(__default_initializable<_Tp>)90  ));91 92template<class _Tp>93_LIBCUDACXX_CONCEPT default_initializable = _LIBCUDACXX_FRAGMENT(_Default_initializable_, _Tp);94 95// [concept.moveconstructible]96template<class _Tp>97_LIBCUDACXX_CONCEPT_FRAGMENT(98  __move_constructible_,99  requires()(100    requires(constructible_from<_Tp, _Tp>),101    requires(convertible_to<_Tp, _Tp>)102  ));103 104template<class _Tp>105_LIBCUDACXX_CONCEPT move_constructible = _LIBCUDACXX_FRAGMENT(__move_constructible_, _Tp);106 107// [concept.copyconstructible]108template<class _Tp>109_LIBCUDACXX_CONCEPT_FRAGMENT(110  __copy_constructible_,111  requires()(112    requires(move_constructible<_Tp>),113    requires(constructible_from<_Tp, add_lvalue_reference_t<_Tp>> && convertible_to<add_lvalue_reference_t<_Tp>, _Tp>),114    requires(constructible_from<_Tp, const add_lvalue_reference_t<_Tp>> && convertible_to<const add_lvalue_reference_t<_Tp>, _Tp>),115    requires(constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>)116  ));117 118template<class _Tp>119_LIBCUDACXX_CONCEPT copy_constructible =  _LIBCUDACXX_FRAGMENT(__copy_constructible_, _Tp);120 121#endif // _LIBCUDACXX_STD_VER > 11122 123_LIBCUDACXX_END_NAMESPACE_STD124 125#endif // _LIBCUDACXX___CONCEPTS_CONSTRUCTIBLE_H126 
codekingpro/portable-devtools · Team Ai