Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Static Public Member Functions
dmlc::ThreadlocalSharedPtr< T > Struct Template Reference

a shared pointer like type that allocate object from a threadlocal object pool. This object is not thread-safe but can be faster than shared_ptr in certain usecases. More...

#include <memory.h>

Public Member Functions

 ThreadlocalSharedPtr ()
 default constructor
 
 ThreadlocalSharedPtr (std::nullptr_t other)
 constructor from nullptr
 
 ThreadlocalSharedPtr (const ThreadlocalSharedPtr< T > &other)
 copy constructor
 
 ThreadlocalSharedPtr (ThreadlocalSharedPtr< T > &&other)
 move constructor
 
 ~ThreadlocalSharedPtr ()
 destructor
 
ThreadlocalSharedPtr< T > & operator= (ThreadlocalSharedPtr< T > &&other)
 move assignment
 
ThreadlocalSharedPtr< T > & operator= (const ThreadlocalSharedPtr< T > &other)
 copy assignment
 
bool operator== (std::nullptr_t other) const
 check if nullptr
 
T * get () const
 
void reset ()
 reset the pointer to nullptr.
 
bool unique () const
 
T * operator* () const
 
T * operator-> () const
 

Static Public Member Functions

template<typename... Args>
static ThreadlocalSharedPtr< T > Create (Args &&... args)
 create a new space from threadlocal storage and return it.
 

Detailed Description

template<typename T>
struct dmlc::ThreadlocalSharedPtr< T >

a shared pointer like type that allocate object from a threadlocal object pool. This object is not thread-safe but can be faster than shared_ptr in certain usecases.

Template Parameters
Tthe data type.

Constructor & Destructor Documentation

◆ ThreadlocalSharedPtr() [1/3]

template<typename T >
dmlc::ThreadlocalSharedPtr< T >::ThreadlocalSharedPtr ( std::nullptr_t  other)
inline

constructor from nullptr

Parameters
otherthe nullptr type

◆ ThreadlocalSharedPtr() [2/3]

template<typename T >
dmlc::ThreadlocalSharedPtr< T >::ThreadlocalSharedPtr ( const ThreadlocalSharedPtr< T > &  other)
inline

copy constructor

Parameters
otheranother pointer.

◆ ThreadlocalSharedPtr() [3/3]

template<typename T >
dmlc::ThreadlocalSharedPtr< T >::ThreadlocalSharedPtr ( ThreadlocalSharedPtr< T > &&  other)
inline

move constructor

Parameters
otheranother pointer.

Member Function Documentation

◆ Create()

template<typename T >
template<typename... Args>
static ThreadlocalSharedPtr< T > dmlc::ThreadlocalSharedPtr< T >::Create ( Args &&...  args)
inlinestatic

create a new space from threadlocal storage and return it.

Template Parameters
Argsthe arguments.
Parameters
argsThe input argument
Returns
the allocated pointer.

◆ get()

template<typename T >
T * dmlc::ThreadlocalSharedPtr< T >::get ( ) const
inline
Returns
get the pointer content.

◆ operator*()

template<typename T >
T * dmlc::ThreadlocalSharedPtr< T >::operator* ( ) const
inline
Returns
dereference pointer

◆ operator->()

template<typename T >
T * dmlc::ThreadlocalSharedPtr< T >::operator-> ( ) const
inline
Returns
dereference pointer

◆ operator=() [1/2]

template<typename T >
ThreadlocalSharedPtr< T > & dmlc::ThreadlocalSharedPtr< T >::operator= ( const ThreadlocalSharedPtr< T > &  other)
inline

copy assignment

Parameters
otheranother object to be assigned.
Returns
self.

◆ operator=() [2/2]

template<typename T >
ThreadlocalSharedPtr< T > & dmlc::ThreadlocalSharedPtr< T >::operator= ( ThreadlocalSharedPtr< T > &&  other)
inline

move assignment

Parameters
otheranother object to be assigned.
Returns
self.

◆ unique()

template<typename T >
bool dmlc::ThreadlocalSharedPtr< T >::unique ( ) const
inline
Returns
if use_count == 1

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