UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MemoryOps.h File Reference
#include "CoreTypes.h"
#include "HAL/UnrealMemory.h"
#include "Templates/UnrealTypeTraits.h"
#include "Traits/UseBitwiseSwap.h"
#include <new>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  UE
 
namespace  UE::Core
 
namespace  UE::Core::Private
 implementation
 
namespace  UE::Core::Private::MemoryOps
 

Functions

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !!TIsZeroConstructType<ElementType>::Value)
FORCEINLINE void DefaultConstructItems (void *Address, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !TIsZeroConstructType<ElementType>::Value)
FORCENOINLINE void DefaultConstructItems (void *Address, SizeType Count)
 
template<typename ElementType >
FORCEINLINE constexpr void DestructItem (ElementType *Element)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_destructible_v<ElementType>)
FORCEINLINE constexpr void DestructItems (ElementType *Element, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_destructible_v<ElementType>)
FORCENOINLINE constexpr void DestructItems (ElementType *Element, SizeType Count)
 
template<typename DestinationElementType , typename SourceElementType , typename SizeType >
requires (sizeof(DestinationElementType) > 0 && sizeof(SourceElementType) > 0 && !!TIsBitwiseConstructible<DestinationElementType, SourceElementType>::Value)
FORCEINLINE void ConstructItems (void *Dest, const SourceElementType *Source, SizeType Count)
 
template<typename DestinationElementType , typename SourceElementType , typename SizeType >
requires (sizeof(DestinationElementType) > 0 && sizeof(SourceElementType) > 0 && !TIsBitwiseConstructible<DestinationElementType, SourceElementType>::Value)
FORCENOINLINE void ConstructItems (void *Dest, const SourceElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_copy_assignable_v<ElementType>)
FORCEINLINE void CopyAssignItems (ElementType *Dest, const ElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_copy_assignable_v<ElementType>)
FORCENOINLINE void CopyAssignItems (ElementType *Dest, const ElementType *Source, SizeType Count)
 
template<typename DestinationElementType , typename SourceElementType , typename SizeType >
FORCEINLINE void RelocateConstructItem (void *Dest, const SourceElementType *Source)
 
template<typename DestinationElementType , typename SourceElementType , typename SizeType >
requires (sizeof(DestinationElementType) > 0 && sizeof(SourceElementType) > 0 && UE::Core::Private::MemoryOps::TCanBitwiseRelocate_V<DestinationElementType, SourceElementType>)
FORCEINLINE void RelocateConstructItems (void *Dest, SourceElementType *Source, SizeType Count)
 
template<typename DestinationElementType , typename SourceElementType , typename SizeType >
requires (sizeof(DestinationElementType) > 0 && sizeof(SourceElementType) > 0 && !UE::Core::Private::MemoryOps::TCanBitwiseRelocate_V<DestinationElementType, SourceElementType>)
FORCENOINLINE void RelocateConstructItems (void *Dest, SourceElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_copy_constructible_v<ElementType>)
FORCEINLINE void MoveConstructItems (void *Dest, const ElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_copy_constructible_v<ElementType>)
FORCENOINLINE void MoveConstructItems (void *Dest, const ElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_copy_assignable_v<ElementType>)
FORCEINLINE void MoveAssignItems (ElementType *Dest, const ElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_copy_assignable_v<ElementType>)
FORCENOINLINE void MoveAssignItems (ElementType *Dest, const ElementType *Source, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !!TTypeTraits<ElementType>::IsBytewiseComparable)
FORCEINLINE bool CompareItems (const ElementType *A, const ElementType *B, SizeType Count)
 
template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !TTypeTraits<ElementType>::IsBytewiseComparable)
FORCENOINLINE bool CompareItems (const ElementType *A, const ElementType *B, SizeType Count)
 

Variables

template<typename DestinationElementType , typename SourceElementType >
constexpr bool UE::Core::Private::MemoryOps::TCanBitwiseRelocate_V
 

Function Documentation

◆ CompareItems() [1/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !!TTypeTraits<ElementType>::IsBytewiseComparable)
FORCEINLINE bool CompareItems ( const ElementType *  A,
const ElementType *  B,
SizeType  Count 
)

◆ CompareItems() [2/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !TTypeTraits<ElementType>::IsBytewiseComparable)
FORCENOINLINE bool CompareItems ( const ElementType *  A,
const ElementType *  B,
SizeType  Count 
)

◆ ConstructItems() [1/2]

Constructs a range of items into memory from a set of arguments. The arguments come from an another array.

Parameters
DestThe memory location to start copying into.
SourceA pointer to the first argument to pass to the constructor.
CountThe number of elements to copy.

◆ ConstructItems() [2/2]

◆ CopyAssignItems() [1/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_copy_assignable_v<ElementType>)
FORCEINLINE void CopyAssignItems ( ElementType *  Dest,
const ElementType *  Source,
SizeType  Count 
)

Copy assigns a range of items.

Parameters
DestThe memory location to start assigning to.
SourceA pointer to the first item to assign.
CountThe number of elements to assign.

◆ CopyAssignItems() [2/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_copy_assignable_v<ElementType>)
FORCENOINLINE void CopyAssignItems ( ElementType *  Dest,
const ElementType *  Source,
SizeType  Count 
)

◆ DefaultConstructItems() [1/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !!TIsZeroConstructType<ElementType>::Value)
FORCEINLINE void DefaultConstructItems ( void Address,
SizeType  Count 
)

Default constructs a range of items in memory.

Parameters
ElementsThe address of the first memory location to construct at.
CountThe number of elements to destruct.

◆ DefaultConstructItems() [2/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !TIsZeroConstructType<ElementType>::Value)
FORCENOINLINE void DefaultConstructItems ( void Address,
SizeType  Count 
)

◆ DestructItem()

template<typename ElementType >
FORCEINLINE constexpr void DestructItem ( ElementType *  Element)
constexpr

Destructs a single item in memory.

Parameters
ElementsA pointer to the item to destruct.
Note
: This function is optimized for values of T, and so will not dynamically dispatch destructor calls if T's destructor is virtual.

◆ DestructItems() [1/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_destructible_v<ElementType>)
FORCEINLINE constexpr void DestructItems ( ElementType *  Element,
SizeType  Count 
)
constexpr

Destructs a range of items in memory.

Parameters
ElementsA pointer to the first item to destruct.
CountThe number of elements to destruct.
Note
: This function is optimized for values of T, and so will not dynamically dispatch destructor calls if T's destructor is virtual.

◆ DestructItems() [2/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_destructible_v<ElementType>)
FORCENOINLINE constexpr void DestructItems ( ElementType *  Element,
SizeType  Count 
)
constexpr

◆ MoveAssignItems() [1/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_copy_assignable_v<ElementType>)
FORCEINLINE void MoveAssignItems ( ElementType *  Dest,
const ElementType *  Source,
SizeType  Count 
)

Move assigns a range of items.

Parameters
DestThe memory location to start move assigning to.
SourceA pointer to the first item to move assign.
CountThe number of elements to move assign.

◆ MoveAssignItems() [2/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_copy_assignable_v<ElementType>)
FORCENOINLINE void MoveAssignItems ( ElementType *  Dest,
const ElementType *  Source,
SizeType  Count 
)

◆ MoveConstructItems() [1/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && std::is_trivially_copy_constructible_v<ElementType>)
FORCEINLINE void MoveConstructItems ( void Dest,
const ElementType *  Source,
SizeType  Count 
)

Move constructs a range of items into memory.

Parameters
DestThe memory location to start moving into.
SourceA pointer to the first item to move from.
CountThe number of elements to move.

◆ MoveConstructItems() [2/2]

template<typename ElementType , typename SizeType >
requires (sizeof(ElementType) > 0 && !std::is_trivially_copy_constructible_v<ElementType>)
FORCENOINLINE void MoveConstructItems ( void Dest,
const ElementType *  Source,
SizeType  Count 
)

◆ RelocateConstructItem()

FORCEINLINE void RelocateConstructItem ( void Dest,
const SourceElementType Source 
)

Relocates a single items to a new memory location as a new type. This is a so-called 'destructive move' for which there is no single operation in C++ but which can be implemented very efficiently in general.

Parameters
DestThe memory location to relocate to.
SourceA pointer to the first item to relocate.

◆ RelocateConstructItems() [1/2]

Relocates a range of items to a new memory location as a new type. This is a so-called 'destructive move' for which there is no single operation in C++ but which can be implemented very efficiently in general.

Parameters
DestThe memory location to relocate to.
SourceA pointer to the first item to relocate.
CountThe number of elements to relocate.

◆ RelocateConstructItems() [2/2]