thrust::device_new_allocator
Defined in thrust/device_new_allocator.h
- 
template<typename T>
 class device_new_allocator
- device_new_allocatoris a device memory allocator that employs the- device_newfunction for allocation.- See also - device_new - See also - Public Types - 
using pointer = device_ptr<T>
- Pointer to allocation, - device_ptr<T>.
 - 
using const_pointer = device_ptr<const T>
- constpointer to allocation,- device_ptr<const T>.
 - 
using reference = device_reference<T>
- Reference to allocated element, - device_reference<T>.
 - 
using const_reference = device_reference<const T>
- constreference to allocated element,- device_reference<const T>.
 - 
using size_type = ::cuda::std::size_t
- Type of allocation size, - ::cuda::std::size_t.
 - Public Functions - 
inline device_new_allocator()
- No-argument constructor has no effect. 
 - 
inline ~device_new_allocator()
- No-argument destructor has no effect. 
 - 
inline device_new_allocator(device_new_allocator const&)
- Copy constructor has no effect. 
 - 
template<typename U>
 inline device_new_allocator(device_new_allocator<U> const&)
- Constructor from other - device_malloc_allocatorhas no effect.
 - 
inline const_pointer address(const_reference r)
- Returns the address an allocated object. - Returns
- &r.
 
 - 
inline pointer allocate(size_type cnt, const_pointer = const_pointer(static_cast<T*>(0)))
- Allocates storage for - cntobjects.- Note - Memory allocated by this function must be deallocated with - deallocate.- Parameters
- cnt – The number of objects to allocate. 
- Returns
- A - pointerto uninitialized storage for- cntobjects.
 
 - 
inline void deallocate(pointer p, size_type cnt) noexcept
- Deallocates storage for objects allocated with - allocate.- Note - Memory deallocated by this function must previously have been allocated with - allocate.- Parameters
- p – A - pointerto the storage to deallocate.
- cnt – The size of the previous allocation. 
 
 
 - 
inline size_type max_size() const
- Returns the largest value - nfor which- allocate(n)might succeed.- Returns
- The largest value - nfor which- allocate(n)might succeed.
 
 - 
inline bool operator==(device_new_allocator const&)
- Compares against another - device_malloc_allocatorfor equality.- Returns
- true
 
 - 
inline bool operator!=(device_new_allocator const &a)
- Compares against another - device_malloc_allocatorfor inequality.- Returns
- false
 
 - 
template<typename U>
 struct rebind
- The - rebindmetafunction provides the type of a- device_new_allocatorinstantiated with another type.- Template Parameters
- U – The other type to use for instantiation. 
 - Public Types - 
using other = device_new_allocator<U>
- The alias - othergives the type of the rebound- device_new_allocator.
 
 
- 
using pointer = device_ptr<T>