Audacity 3.2.0
Public Member Functions | List of all members
AtomicUniquePointer< T > Struct Template Reference

#include <MemoryX.h>

Inheritance diagram for AtomicUniquePointer< T >:
[legend]
Collaboration diagram for AtomicUniquePointer< T >:
[legend]

Public Member Functions

void reset (T *p=nullptr)
 
template<typename... Args>
void emplace (Args &&... args)
 reset to a pointer to a new object with given ctor arguments More...
 
 ~AtomicUniquePointer ()
 

Detailed Description

template<typename T>
struct AtomicUniquePointer< T >

Atomic unique pointer (for nonarray type only) with a destructor; It doesn't copy or move

Definition at line 346 of file MemoryX.h.

Constructor & Destructor Documentation

◆ ~AtomicUniquePointer()

template<typename T >
AtomicUniquePointer< T >::~AtomicUniquePointer ( )
inline

Definition at line 360 of file MemoryX.h.

360{ reset(); }
void reset(T *p=nullptr)
Definition: MemoryX.h:353

References AtomicUniquePointer< T >::reset().

Here is the call graph for this function:

Member Function Documentation

◆ emplace()

template<typename T >
template<typename... Args>
void AtomicUniquePointer< T >::emplace ( Args &&...  args)
inline

reset to a pointer to a new object with given ctor arguments

Definition at line 357 of file MemoryX.h.

357 {
358 reset(safenew T(std::forward<Args>(args)...));
359 }
#define safenew
Definition: MemoryX.h:10

References AtomicUniquePointer< T >::reset(), and safenew.

Here is the call graph for this function:

◆ reset()

template<typename T >
void AtomicUniquePointer< T >::reset ( T *  p = nullptr)
inline

Reassign the pointer with release ordering, then destroy any previously held object

Like std::unique_ptr, does not check for reassignment of the same pointer

Definition at line 353 of file MemoryX.h.

353 {
354 delete this->exchange(p, std::memory_order_release);
355 }

Referenced by AtomicUniquePointer< T >::emplace(), and AtomicUniquePointer< T >::~AtomicUniquePointer().

Here is the caller graph for this function:

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