Template Class device_new_allocator¶
Defined in File device_new_allocator.h
Inheritance Relationships¶
Derived Type¶
public thrust::device_allocator< T >
(Template Class device_allocator)
Class Documentation¶
-
template<typename
T
>
classdevice_new_allocator
¶ device_new_allocator
is a device memory allocator that employs thedevice_new
function for allocation.Subclassed by thrust::device_allocator< T >
Public Types
-
typedef T
value_type
¶ Type of element allocated,
T
.
-
typedef device_ptr<T>
pointer
¶ Pointer to allocation,
device_ptr<T>
.
-
typedef device_ptr<const T>
const_pointer
¶ const
pointer to allocation,device_ptr<const T>
.
-
typedef device_reference<T>
reference
¶ Reference to allocated element,
device_reference<T>
.
-
typedef device_reference<const T>
const_reference
¶ const
reference to allocated element,device_reference<const T>
.
-
typedef std::size_t
size_type
¶ Type of allocation size,
std::size_t
.
Public Functions
-
__host__ __device__ thrust::device_new_allocator::device_new_allocator()
No-argument constructor has no effect.
-
__host__ __device__ thrust::device_new_allocator::~device_new_allocator()
No-argument destructor has no effect.
-
__host__ __device__ thrust::device_new_allocator::device_new_allocator(device_new_allocator const &)
Copy constructor has no effect.
-
template<typename U>__host__ __device__ thrust::device_new_allocator::device_new_allocator(device_new_allocator < U > const &)
Constructor from other
device_malloc_allocator
has no effect.
-
__host__ __device__ pointer thrust::device_new_allocator::address(reference r)
Returns the address of an allocated object.
- Return
&r
.
-
__host__ __device__ const_pointer thrust::device_new_allocator::address(const_reference r)
Returns the address an allocated object.
- Return
&r
.
-
__host__ pointer thrust::device_new_allocator::allocate(size_type cnt, const_pointer = const_pointer (static_cast< T *>(0)))
Allocates storage for
cnt
objects.- Return
A
pointer
to uninitialized storage forcnt
objects.- Note
Memory allocated by this function must be deallocated with
deallocate
.- Parameters
cnt
: The number of objects to allocate.
-
__host__ void thrust::device_new_allocator::deallocate(pointer p, size_type)
Deallocates storage for objects allocated with
allocate
.- Note
Memory deallocated by this function must previously have been allocated with
allocate
.- Parameters
p
: Apointer
to the storage to deallocate.cnt
: The size of the previous allocation.
-
__host__ __device__ size_type thrust::device_new_allocator::max_size() const
Returns the largest value
n
for whichallocate(n)
might succeed.- Return
The largest value
n
for whichallocate(n)
might succeed.
-
__host__ __device__ bool thrust::device_new_allocator::operator==(device_new_allocator const &)
Compares against another
device_malloc_allocator
for equality.- Return
true
-
__host__ __device__ bool thrust::device_new_allocator::operator!=(device_new_allocator const & a)
Compares against another
device_malloc_allocator
for inequality.- Return
false
-
template<typename
U
>
structrebind
¶ The
rebind
metafunction provides the type of adevice_new_allocator
instantiated with another type.- Template Parameters
U
: The other type to use for instantiation.
Public Types
-
template<>
typedef device_new_allocator<U>other
¶ The typedef
other
gives the type of the rebounddevice_new_allocator
.
-
typedef T