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

Constructor & Destructor Documentation

◆ ~AtomicUniquePointer()

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

Definition at line 652 of file MemoryX.h.

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

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

649 {
650 reset(safenew T(std::forward<Args>(args)...));
651 }
#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)

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

645 {
646 delete this->exchange(p, std::memory_order_release);
647 }

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: