31
31
#include < cuda/std/__type_traits/is_array.h>
32
32
#include < cuda/std/__type_traits/is_constant_evaluated.h>
33
33
#include < cuda/std/__type_traits/is_trivially_constructible.h>
34
+ #include < cuda/std/__type_traits/is_trivially_destructible.h>
34
35
#include < cuda/std/__type_traits/is_trivially_move_assignable.h>
35
36
#include < cuda/std/__type_traits/void_t.h>
36
37
#include < cuda/std/__utility/declval.h>
@@ -181,26 +182,39 @@ __construct_at(_Tp* __location, _Args&&... __args)
181
182
// The internal functions are available regardless of the language version (with the exception of the `__destroy_at`
182
183
// taking an array).
183
184
template <class _ForwardIterator >
184
- _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 _ForwardIterator __destroy (_ForwardIterator, _ForwardIterator);
185
+ _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX14 _ForwardIterator __destroy (_ForwardIterator, _ForwardIterator);
185
186
186
- template <class _Tp , __enable_if_t <!is_array<_Tp>::value, int > = 0 >
187
- _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 void __destroy_at (_Tp* __loc)
187
+ _CCCL_EXEC_CHECK_DISABLE
188
+ template <class _Tp ,
189
+ __enable_if_t <!is_array<_Tp>::value, int > = 0 ,
190
+ __enable_if_t <!is_trivially_destructible<_Tp>::value, int > = 0 >
191
+ _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX14 void __destroy_at (_Tp* __loc)
188
192
{
189
193
_LIBCUDACXX_ASSERT (__loc != nullptr , " null pointer given to destroy_at" );
190
194
__loc->~_Tp ();
191
195
}
192
196
197
+ _CCCL_EXEC_CHECK_DISABLE
198
+ template <class _Tp ,
199
+ __enable_if_t <!is_array<_Tp>::value, int > = 0 ,
200
+ __enable_if_t <is_trivially_destructible<_Tp>::value, int > = 0 >
201
+ _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX14 void __destroy_at (_Tp* __loc)
202
+ {
203
+ _LIBCUDACXX_ASSERT (__loc != nullptr , " null pointer given to destroy_at" );
204
+ (void ) __loc;
205
+ }
206
+
193
207
#if _CCCL_STD_VER >= 2020
194
208
template <class _Tp , __enable_if_t <is_array<_Tp>::value, int > = 0 >
195
- _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 void __destroy_at (_Tp* __loc)
209
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr void __destroy_at (_Tp* __loc)
196
210
{
197
211
_LIBCUDACXX_ASSERT (__loc != nullptr , " null pointer given to destroy_at" );
198
212
_CUDA_VSTD::__destroy (_CUDA_VSTD::begin (*__loc), _CUDA_VSTD::end (*__loc));
199
213
}
200
- #endif
214
+ #endif // _CCCL_STD_VER >= 2020
201
215
202
216
template <class _ForwardIterator >
203
- _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 _ForwardIterator
217
+ _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX14 _ForwardIterator
204
218
__destroy (_ForwardIterator __first, _ForwardIterator __last)
205
219
{
206
220
for (; __first != __last; ++__first)
@@ -211,7 +225,7 @@ __destroy(_ForwardIterator __first, _ForwardIterator __last)
211
225
}
212
226
213
227
template <class _BidirectionalIterator >
214
- _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 _BidirectionalIterator
228
+ _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX14 _BidirectionalIterator
215
229
__reverse_destroy (_BidirectionalIterator __first, _BidirectionalIterator __last)
216
230
{
217
231
while (__last != __first)
@@ -222,7 +236,7 @@ __reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last)
222
236
return __last;
223
237
}
224
238
225
- #if _CCCL_STD_VER > 2014
239
+ #if _CCCL_STD_VER >= 2017
226
240
227
241
template <class _Tp , enable_if_t <!is_array_v<_Tp>, int > = 0 >
228
242
_LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 void destroy_at (_Tp* __loc) noexcept
@@ -256,7 +270,7 @@ _LIBCUDACXX_INLINE_VISIBILITY _CCCL_CONSTEXPR_CXX20 _ForwardIterator destroy_n(_
256
270
return __first;
257
271
}
258
272
259
- #endif // _CCCL_STD_VER > 2014
273
+ #endif // _CCCL_STD_VER >= 2017
260
274
261
275
_LIBCUDACXX_END_NAMESPACE_STD
262
276
0 commit comments