Cuda battery library
Loading...
Searching...
No Matches
unique_ptr.hpp File Reference
#include "utility.hpp"
#include "allocator.hpp"

Go to the source code of this file.

Classes

class  battery::unique_ptr< T, Allocator >
 

Namespaces

namespace  battery
 

Functions

template<class T , class Alloc , class... Args>
CUDA NI unique_ptr< T, Alloc > battery::allocate_unique (const Alloc &alloc, Args &&... args)
 
template<class T , class Alloc , class... Args>
CUDA unique_ptr< T, Alloc > battery::make_unique (Args &&... args)
 

Detailed Description

Similar to std::unique_ptr with small technical differences:

  • There is no specialization for arrays (e.g., unique_ptr<T[]>).
  • We rely on an allocator and provide a function allocate_unique to build the pointer in place.
  • Additional function make_unique_block and make_unique_grid Similarly to vector, the allocator is scoped, meaning it is propagated to the underlying type constructor if it takes one.