Cuda battery library
Loading...
Searching...
No Matches
battery::shared_ptr< T, Allocator > Class Template Reference

#include <shared_ptr.hpp>

Public Types

using element_type = T
 
using pointer = T*
 
using allocator_type = Allocator
 
using this_type = shared_ptr<element_type, allocator_type>
 

Public Member Functions

CUDA shared_ptr (const allocator_type &allocator=allocator_type())
 
CUDA shared_ptr (std::nullptr_t, const allocator_type &allocator=allocator_type())
 
template<class Y >
CUDA NI shared_ptr (Y *ptr, const allocator_type &allocator=allocator_type())
 
CUDA shared_ptr (this_type &&from)
 
template<class Y >
CUDA shared_ptr (shared_ptr< Y, Allocator > &&from)
 
CUDA shared_ptr (const this_type &from)
 
template<class Y >
CUDA shared_ptr (const shared_ptr< Y, Allocator > &from)
 
CUDA NI ~shared_ptr ()
 
CUDA void swap (shared_ptr &other)
 
CUDA shared_ptroperator= (const shared_ptr &r)
 
CUDA shared_ptroperator= (shared_ptr &&r)
 
template<class Y >
CUDA shared_ptroperator= (const shared_ptr< Y, Allocator > &r)
 
template<class Y >
CUDA shared_ptroperator= (shared_ptr< Y, Allocator > &&r)
 
CUDA shared_ptroperator= (std::nullptr_t)
 
CUDA void reset ()
 
template<class Y >
CUDA void reset (Y *ptr)
 
CUDA pointer get () const
 
CUDA T & operator* () const
 
CUDA pointer operator-> () const
 
CUDA int use_count () const
 
CUDA allocator_type get_allocator () const
 
CUDA operator bool () const
 

Friends

template<class Y , class Alloc >
class shared_ptr
 

Detailed Description

template<class T, class Allocator = standard_allocator>
class battery::shared_ptr< T, Allocator >

Similar to std::shared_ptr but with some (technical) differences:

  • There is no specialization for arrays (e.g., shared_ptr<T[]>).
  • It is parametrized by an allocator to allocate/deallocate the memory.
  • No support for aliasing constructors.
  • No special thread-safety support. Similarly to vector, the allocator is scoped, meaning it is propagated to the underlying type constructor if it takes one.

Member Typedef Documentation

◆ element_type

template<class T , class Allocator = standard_allocator>
using battery::shared_ptr< T, Allocator >::element_type = T

◆ pointer

template<class T , class Allocator = standard_allocator>
using battery::shared_ptr< T, Allocator >::pointer = T*

◆ allocator_type

template<class T , class Allocator = standard_allocator>
using battery::shared_ptr< T, Allocator >::allocator_type = Allocator

◆ this_type

template<class T , class Allocator = standard_allocator>
using battery::shared_ptr< T, Allocator >::this_type = shared_ptr<element_type, allocator_type>

Constructor & Destructor Documentation

◆ shared_ptr() [1/7]

template<class T , class Allocator = standard_allocator>
CUDA battery::shared_ptr< T, Allocator >::shared_ptr ( const allocator_type & allocator = allocator_type())
inline

◆ shared_ptr() [2/7]

template<class T , class Allocator = standard_allocator>
CUDA battery::shared_ptr< T, Allocator >::shared_ptr ( std::nullptr_t ,
const allocator_type & allocator = allocator_type() )
inline

◆ shared_ptr() [3/7]

template<class T , class Allocator = standard_allocator>
template<class Y >
CUDA NI battery::shared_ptr< T, Allocator >::shared_ptr ( Y * ptr,
const allocator_type & allocator = allocator_type() )
inlineexplicit

◆ shared_ptr() [4/7]

template<class T , class Allocator = standard_allocator>
CUDA battery::shared_ptr< T, Allocator >::shared_ptr ( this_type && from)
inline

◆ shared_ptr() [5/7]

template<class T , class Allocator = standard_allocator>
template<class Y >
CUDA battery::shared_ptr< T, Allocator >::shared_ptr ( shared_ptr< Y, Allocator > && from)
inline

◆ shared_ptr() [6/7]

template<class T , class Allocator = standard_allocator>
CUDA battery::shared_ptr< T, Allocator >::shared_ptr ( const this_type & from)
inline

◆ shared_ptr() [7/7]

template<class T , class Allocator = standard_allocator>
template<class Y >
CUDA battery::shared_ptr< T, Allocator >::shared_ptr ( const shared_ptr< Y, Allocator > & from)
inline

◆ ~shared_ptr()

template<class T , class Allocator = standard_allocator>
CUDA NI battery::shared_ptr< T, Allocator >::~shared_ptr ( )
inline

Member Function Documentation

◆ swap()

template<class T , class Allocator = standard_allocator>
CUDA void battery::shared_ptr< T, Allocator >::swap ( shared_ptr< T, Allocator > & other)
inline

◆ operator=() [1/5]

template<class T , class Allocator = standard_allocator>
CUDA shared_ptr & battery::shared_ptr< T, Allocator >::operator= ( const shared_ptr< T, Allocator > & r)
inline

◆ operator=() [2/5]

template<class T , class Allocator = standard_allocator>
CUDA shared_ptr & battery::shared_ptr< T, Allocator >::operator= ( shared_ptr< T, Allocator > && r)
inline

◆ operator=() [3/5]

template<class T , class Allocator = standard_allocator>
template<class Y >
CUDA shared_ptr & battery::shared_ptr< T, Allocator >::operator= ( const shared_ptr< Y, Allocator > & r)
inline

◆ operator=() [4/5]

template<class T , class Allocator = standard_allocator>
template<class Y >
CUDA shared_ptr & battery::shared_ptr< T, Allocator >::operator= ( shared_ptr< Y, Allocator > && r)
inline

◆ operator=() [5/5]

template<class T , class Allocator = standard_allocator>
CUDA shared_ptr & battery::shared_ptr< T, Allocator >::operator= ( std::nullptr_t )
inline

◆ reset() [1/2]

template<class T , class Allocator = standard_allocator>
CUDA void battery::shared_ptr< T, Allocator >::reset ( )
inline

◆ reset() [2/2]

template<class T , class Allocator = standard_allocator>
template<class Y >
CUDA void battery::shared_ptr< T, Allocator >::reset ( Y * ptr)
inline

◆ get()

template<class T , class Allocator = standard_allocator>
CUDA pointer battery::shared_ptr< T, Allocator >::get ( ) const
inline

◆ operator*()

template<class T , class Allocator = standard_allocator>
CUDA T & battery::shared_ptr< T, Allocator >::operator* ( ) const
inline

◆ operator->()

template<class T , class Allocator = standard_allocator>
CUDA pointer battery::shared_ptr< T, Allocator >::operator-> ( ) const
inline

◆ use_count()

template<class T , class Allocator = standard_allocator>
CUDA int battery::shared_ptr< T, Allocator >::use_count ( ) const
inline

◆ get_allocator()

template<class T , class Allocator = standard_allocator>
CUDA allocator_type battery::shared_ptr< T, Allocator >::get_allocator ( ) const
inline

◆ operator bool()

template<class T , class Allocator = standard_allocator>
CUDA battery::shared_ptr< T, Allocator >::operator bool ( ) const
inlineexplicit

Friends And Related Symbol Documentation

◆ shared_ptr

template<class T , class Allocator = standard_allocator>
template<class Y , class Alloc >
friend class shared_ptr
friend

The documentation for this class was generated from the following file: