UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TAtomicBase_Basic< T > Struct Template Reference

#include <Atomic.h>

+ Inheritance diagram for TAtomicBase_Basic< T >:

Public Member Functions

FORCEINLINELoad (EMemoryOrder Order=EMemoryOrder::SequentiallyConsistent) const
 
FORCEINLINE void Store (T Value, EMemoryOrder Order=EMemoryOrder::SequentiallyConsistent)
 
FORCEINLINEExchange (T Value)
 
FORCEINLINE bool CompareExchange (T &Expected, T Value)
 

Protected Member Functions

 TAtomicBase_Basic ()=default
 
constexpr TAtomicBase_Basic (T Value)
 

Protected Attributes

std::atomic< T > Element
 

Constructor & Destructor Documentation

◆ TAtomicBase_Basic() [1/2]

template<typename T >
TAtomicBase_Basic< T >::TAtomicBase_Basic ( )
protecteddefault

◆ TAtomicBase_Basic() [2/2]

template<typename T >
constexpr TAtomicBase_Basic< T >::TAtomicBase_Basic ( Value)
inlineconstexprprotected

Member Function Documentation

◆ CompareExchange()

template<typename T >
FORCEINLINE bool TAtomicBase_Basic< T >::CompareExchange ( T &  Expected,
Value 
)
inline

Compares the element with an expected value and, only if comparison succeeds, assigns the element to a new value. The previous value is copied into Expected in any case.

Parameters
ExpectedThe value to compare to the element, and will hold the existing value of the element after returning.
ValueThe value to assign, only if Expected matches the element.
Returns
Whether the element compared equal to Expected.
Note
It is equivalent to this in non-atomic terms:

bool CompareExchange(T& Expected, T Value) { bool bResult = this->Element == Expected; Expected = this->Element; if (bResult) { this->Element = Value; } return bResult; }

◆ Exchange()

template<typename T >
FORCEINLINE T TAtomicBase_Basic< T >::Exchange ( Value)
inline

Sets the element to a specific value, returning a copy of the previous value.

Parameters
ValueThe value to set the element to.
Returns
A copy of the previous value.

◆ Load()

template<typename T >
FORCEINLINE T TAtomicBase_Basic< T >::Load ( EMemoryOrder  Order = EMemoryOrder::SequentiallyConsistent) const
inline

Gets a copy of the current value of the element.

Parameters
OrderThe memory ordering semantics to apply to the operation.
Returns
The current value.

◆ Store()

template<typename T >
FORCEINLINE void TAtomicBase_Basic< T >::Store ( Value,
EMemoryOrder  Order = EMemoryOrder::SequentiallyConsistent 
)
inline

Sets the element to a specific value.

Parameters
ValueThe value to set the element to.
OrderThe memory ordering semantics to apply to the operation.

Member Data Documentation

◆ Element

template<typename T >
std::atomic<T> TAtomicBase_Basic< T >::Element
protected

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