Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
__memory90 linesDownload Raw Back to experimental
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX_EXPERIMENTAL___MEMORY11#define _LIBCUDACXX_EXPERIMENTAL___MEMORY12 13#include <experimental/__config>14#include <experimental/utility> // for erased_type15#include <__functional_base>16#include <type_traits>17 18_LIBCUDACXX_BEGIN_NAMESPACE_LFTS19 20template <21    class _Tp, class _Alloc22  , bool = uses_allocator<_Tp, _Alloc>::value23  , bool = __has_allocator_type<_Tp>::value24  >25struct __lfts_uses_allocator : public false_type {};26 27template <class _Tp, class _Alloc>28struct __lfts_uses_allocator<_Tp, _Alloc, false, false> : public false_type {};29 30template <class _Tp, class _Alloc, bool HasAlloc>31struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {};32 33template <class _Tp, class _Alloc>34struct __lfts_uses_allocator<_Tp, _Alloc, false, true>35  : public integral_constant<bool36    , is_convertible<_Alloc, typename _Tp::allocator_type>::value37      || is_same<erased_type, typename _Tp::allocator_type>::value38    >39{};40 41template <bool _UsesAlloc, class _Tp, class _Alloc, class ..._Args>42struct __lfts_uses_alloc_ctor_imp43{44    static const int value = 0;45};46 47template <class _Tp, class _Alloc, class ..._Args>48struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...>49{50    static const bool __ic_first51        = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;52 53    static const bool __ic_second =54        conditional<55            __ic_first,56            false_type,57            is_constructible<_Tp, _Args..., _Alloc>58        >::type::value;59 60    static_assert(__ic_first || __ic_second,61                  "Request for uses allocator construction is ill-formed");62 63    static const int value = __ic_first ? 1 : 2;64};65 66template <class _Tp, class _Alloc, class ..._Args>67struct __lfts_uses_alloc_ctor68  : integral_constant<int,69        __lfts_uses_alloc_ctor_imp<70            __lfts_uses_allocator<_Tp, _Alloc>::value71          , _Tp, _Alloc, _Args...72        >::value73    >74{};75 76template <class _Tp, class _Alloc, class ..._Args>77inline _LIBCUDACXX_INLINE_VISIBILITY78void __lfts_user_alloc_construct(79    _Tp * __store, const _Alloc & __a, _Args &&... __args)80{81    _CUDA_VSTD::__user_alloc_construct_impl(82        typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type()83       , __store, __a, _CUDA_VSTD::forward<_Args>(__args)...84       );85}86 87_LIBCUDACXX_END_NAMESPACE_LFTS88 89#endif /* _LIBCUDACXX_EXPERIMENTAL___MEMORY */90 
codekingpro/portable-devtools · Team Ai