Async++ unknown
Async (co_await/co_return) code for C++
Loading...
Searching...
No Matches
asyncpp::ref< T > Class Template Reference

Reference count handle. More...

#include <asyncpp/ref.h>

Public Member Functions

constexpr ref () noexcept
 Construct an empty ref.
 
 ref (T *ptr, decltype(adopt_ref)) noexcept
 Construct a new ref object.
 
 ref (T *ptr) noexcept(noexcept(refcounted_add_ref(std::declval< T * >())))
 Construct a new ref object incrementing the reference count of the passed pointer.
 
 ref (const ref &other) noexcept(noexcept(refcounted_add_ref(std::declval< T * >())))
 Construct a new ref object.
 
constexpr ref (ref &&other) noexcept
 Move constructor.
 
refoperator= (const ref &other) noexcept(noexcept(refcounted_add_ref(std::declval< T * >())) &&noexcept(refcounted_remove_ref(std::declval< T * >())))
 Assignment operator.
 
refoperator= (ref &&other) noexcept(noexcept(refcounted_remove_ref(std::declval< T * >())))
 Move assignment operator.
 
void reset (T *ptr) noexcept(noexcept(refcounted_add_ref(std::declval< T * >())) &&noexcept(refcounted_remove_ref(std::declval< T * >())))
 Reset the handle with a new value.
 
void reset (T *ptr, decltype(adopt_ref)) noexcept(noexcept(refcounted_remove_ref(std::declval< T * >())))
 Reset the handle with a new value.
 
void reset () noexcept(noexcept(refcounted_remove_ref(std::declval< T * >())))
 Reset the handle to nullptr.
 
 ~ref () noexcept(noexcept(refcounted_remove_ref(std::declval< T * >())))
 Destructor.
 
constexpr T * operator-> () const noexcept
 Dereference this handle.
 
constexpr T & operator* () const noexcept
 Dereference this handle.
 
constexpr T * get () const noexcept
 Get the contained value.
 
constexpr T * release () noexcept
 Release the contained pointer.
 
constexpr operator bool () const noexcept
 Check if the handle contains a pointer.
 
constexpr bool operator! () const noexcept
 Check if the handle contains no pointer.
 

Detailed Description

template<typename T>
class asyncpp::ref< T >

Reference count handle.

Template Parameters
TType of the reference counted class

Constructor & Destructor Documentation

◆ ref() [1/3]

template<typename T >
asyncpp::ref< T >::ref ( T * ptr,
decltype(adopt_ref< T >)  )
inlinenoexcept

Construct a new ref object.

Parameters
ptrThe pointer to store
adopt_refthe reference count is already incremented, keep it as is

◆ ref() [2/3]

template<typename T >
asyncpp::ref< T >::ref ( T * ptr)
inlinenoexcept

Construct a new ref object incrementing the reference count of the passed pointer.

Parameters
ptrThe pointer to store

◆ ref() [3/3]

template<typename T >
asyncpp::ref< T >::ref ( const ref< T > & other)
inlinenoexcept

Construct a new ref object.

Parameters
ptrThe pointer to store
adopt_refthe reference count is already incremented, keep it as is

Copy constructor

Member Function Documentation

◆ reset() [1/2]

template<typename T >
void asyncpp::ref< T >::reset ( T * ptr)
inlinenoexcept

Reset the handle with a new value.

Parameters
ptrThe new pointer
adopt_refthe reference count is already incremented, keep it as is

◆ reset() [2/2]

template<typename T >
void asyncpp::ref< T >::reset ( T * ptr,
decltype(adopt_ref< T >)  )
inlinenoexcept

Reset the handle with a new value.

Parameters
ptrThe new pointer
adopt_refthe reference count is already incremented, keep it as is

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