FreeTensor
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
freetensor::Ref< T > Class Template Reference

#include <ref.h>

Public Types

typedef T Object
 

Public Member Functions

 Ref ()=default
 
 Ref (std::nullptr_t)
 
 Ref (const Ref &)=default
 
 Ref (Ref &&)=default
 
 Ref (T *ptr)
 
template<std::derived_from< T > U>
 Ref (const Ref< U > &other)
 
template<std::derived_from< T > U>
Refoperator= (const Ref< U > &other)
 
Refoperator= (const Ref &)=default
 
Refoperator= (Ref &&)=default
 
template<class U >
Ref< U > as () const
 
bool isValid () const
 
T & operator* () const
 
T * operator-> () const
 
T * get () const
 

Static Public Member Functions

static Ref make ()
 
static Ref make (T &&x)
 
static Ref make (const T &x)
 
template<class... Args>
static Ref make (Args &&...args)
 

Friends

template<class U >
class Ref
 
template<class U >
class Weak
 
template<class U >
class EnableSelf
 
bool operator== (const Ref &lhs, const Ref &rhs)
 
auto operator<=> (const Ref &lhs, const Ref &rhs)
 

Detailed Description

template<class T>
class freetensor::Ref< T >

Ref-counting pointer

This class is thread-safe (For developers: concurrent accesses through different std::shared_ptrs to the same object is already thread-safe, while modifying the same std::shared_ptr is not. We never modify a Ref, so no locks are needed. See https://en.cppreference.com/w/cpp/memory/shared_ptr)

Member Typedef Documentation

◆ Object

template<class T >
typedef T freetensor::Ref< T >::Object

Constructor & Destructor Documentation

◆ Ref() [1/6]

template<class T >
freetensor::Ref< T >::Ref ( )
default

◆ Ref() [2/6]

template<class T >
freetensor::Ref< T >::Ref ( std::nullptr_t  )
inline

◆ Ref() [3/6]

template<class T >
freetensor::Ref< T >::Ref ( const Ref< T > &  )
default

◆ Ref() [4/6]

template<class T >
freetensor::Ref< T >::Ref ( Ref< T > &&  )
default

◆ Ref() [5/6]

template<class T >
freetensor::Ref< T >::Ref ( T *  ptr)
inline

NO NOT USE THIS CONSTRUCTOR IN PUBLIC It is public because Pybind11 needs it

◆ Ref() [6/6]

template<class T >
template<std::derived_from< T > U>
freetensor::Ref< T >::Ref ( const Ref< U > &  other)
inline

Shared with any compatible references

Member Function Documentation

◆ as()

template<class T >
template<class U >
Ref< U > freetensor::Ref< T >::as ( ) const
inline

◆ get()

template<class T >
T * freetensor::Ref< T >::get ( ) const
inline

◆ isValid()

template<class T >
bool freetensor::Ref< T >::isValid ( ) const
inline

◆ make() [1/4]

template<class T >
static Ref freetensor::Ref< T >::make ( )
inlinestatic

◆ make() [2/4]

template<class T >
template<class... Args>
static Ref freetensor::Ref< T >::make ( Args &&...  args)
inlinestatic

◆ make() [3/4]

template<class T >
static Ref freetensor::Ref< T >::make ( const T &  x)
inlinestatic

◆ make() [4/4]

template<class T >
static Ref freetensor::Ref< T >::make ( T &&  x)
inlinestatic

◆ operator*()

template<class T >
T & freetensor::Ref< T >::operator* ( ) const
inline

◆ operator->()

template<class T >
T * freetensor::Ref< T >::operator-> ( ) const
inline

◆ operator=() [1/3]

template<class T >
Ref & freetensor::Ref< T >::operator= ( const Ref< T > &  )
default

◆ operator=() [2/3]

template<class T >
template<std::derived_from< T > U>
Ref & freetensor::Ref< T >::operator= ( const Ref< U > &  other)
inline

◆ operator=() [3/3]

template<class T >
Ref & freetensor::Ref< T >::operator= ( Ref< T > &&  )
default

Friends And Related Function Documentation

◆ EnableSelf

template<class T >
template<class U >
friend class EnableSelf
friend

◆ operator<=>

template<class T >
auto operator<=> ( const Ref< T > &  lhs,
const Ref< T > &  rhs 
)
friend

◆ operator==

template<class T >
bool operator== ( const Ref< T > &  lhs,
const Ref< T > &  rhs 
)
friend

◆ Ref

template<class T >
template<class U >
friend class Ref
friend

◆ Weak

template<class T >
template<class U >
friend class Weak
friend

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