-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMemoryOps.h
25 lines (21 loc) · 958 Bytes
/
MemoryOps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include "inc.h"
#include "EnableIf.h"
#include "UnrealTypeTraits.h"
template <typename DestinationElementType, typename SourceElementType, typename SizeType>
FORCEINLINE typename TEnableIf<!TIsBitwiseConstructible<DestinationElementType, SourceElementType>::Value>::Type ConstructItems(void* Dest, const SourceElementType* Source, SizeType Count, int ElementSize = sizeof(SourceElementType))
{
while (Count)
{
new (Dest) DestinationElementType(*Source);
++(DestinationElementType*&)Dest;
++Source;
--Count;
}
}
template <typename DestinationElementType, typename SourceElementType, typename SizeType>
FORCEINLINE typename TEnableIf<TIsBitwiseConstructible<DestinationElementType, SourceElementType>::Value>::Type ConstructItems(void* Dest, const SourceElementType* Source, SizeType Count, int ElementSize = sizeof(SourceElementType))
{
// FMemory::Memcpy(Dest, Source, ElementSize * Count);
memcpy(Dest, Source, ElementSize);
}