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

#include <MemoryX.h>

Inheritance diagram for AtomicUniquePointer< T >:
Collaboration diagram for AtomicUniquePointer< T >:

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 343 of file MemoryX.h.

Constructor & Destructor Documentation

◆ ~AtomicUniquePointer()

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

Definition at line 357 of file MemoryX.h.

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

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)

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

Definition at line 354 of file MemoryX.h.

354 {
355 reset(safenew T(std::forward<Args>(args)...));
356 }
#define safenew
Definition: MemoryX.h:9

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)

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 350 of file MemoryX.h.

350 {
351 delete this->exchange(p, std::memory_order_release);
352 }

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: