| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
|
|
| #pragma once |
|
|
| #include <thrust/detail/config.h> |
|
|
| #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) |
| # pragma GCC system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) |
| # pragma clang system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) |
| # pragma system_header |
| #endif |
| #include <thrust/detail/cpp11_required.h> |
|
|
| #if THRUST_CPP_DIALECT >= 2011 |
|
|
| #include <thrust/allocate_unique.h> |
| #include <thrust/device_new.h> |
| #include <thrust/device_ptr.h> |
| #include <thrust/device_allocator.h> |
| #include <thrust/detail/type_deduction.h> |
|
|
| THRUST_NAMESPACE_BEGIN |
|
|
| |
|
|
| template <typename T, typename... Args> |
| __host__ |
| auto device_make_unique(Args&&... args) |
| THRUST_TRAILING_RETURN(decltype( |
| uninitialized_allocate_unique<T>(device_allocator<T>{}) |
| )) |
| { |
| #if !defined(THRUST_DOXYGEN) |
| |
| |
| |
| auto p = uninitialized_allocate_unique<T>(device_allocator<T>{}); |
| device_new<T>(p.get(), T(THRUST_FWD(args)...)); |
| return p; |
| #endif |
| } |
|
|
| |
|
|
| THRUST_NAMESPACE_END |
|
|
| #endif |
|
|