2021-09-26 15:24:15 +00:00
|
|
|
#include "CoreMinimal.h"
|
2021-10-05 10:33:18 +00:00
|
|
|
#include "HAL/Memory.h"
|
2021-09-26 15:24:15 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <cassert>
|
2021-10-05 10:33:18 +00:00
|
|
|
#include <new>
|
2021-09-26 15:24:15 +00:00
|
|
|
|
|
|
|
NS_STD_USING
|
|
|
|
NS_REDCRAFT_USING
|
|
|
|
|
2021-10-06 07:06:49 +00:00
|
|
|
struct FTest
|
|
|
|
{
|
|
|
|
FTest() { cout << "FTest()" << endl; }
|
|
|
|
~FTest() { cout << "~FTest()" << endl; }
|
|
|
|
FTest(int32) { cout << "FTest(int32)" << endl; }
|
|
|
|
FTest(const FTest&) { cout << "FTest(const FTest&)" << endl; }
|
|
|
|
FTest(FTest&&) { cout << "FTest(FTest&&)" << endl; }
|
|
|
|
FTest& operator =(const FTest&) { cout << "FTest& operator =(const FTest&)" << endl; return *this; }
|
|
|
|
FTest& operator =(FTest&&) { cout << "FTest& operator =(FTest&&)" << endl; return *this; }
|
|
|
|
friend bool operator ==(const FTest&, const FTest&) { cout << "bool operator ==(const FTest&, const FTest&)" << endl; return true; }
|
|
|
|
};
|
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
int main()
|
|
|
|
{
|
2021-10-06 07:06:49 +00:00
|
|
|
FTest* A = new FTest[2];
|
|
|
|
FTest* B = new FTest[2];
|
|
|
|
int32* C = new int32[2];
|
|
|
|
int32* D = new int32[2];
|
|
|
|
|
|
|
|
cout << " --- " << endl;
|
|
|
|
|
|
|
|
Memory::DefaultConstructItems<FTest>(A, 2);
|
|
|
|
Memory::DestructItems<FTest>(A, 2);
|
|
|
|
Memory::ConstructItems<FTest>(A, C, 2);
|
|
|
|
Memory::CopyAssignItems(B, A, 2);
|
|
|
|
Memory::RelocateConstructItems<FTest>(A, C, 2);
|
|
|
|
Memory::MoveConstructItems(B, A, 2);
|
|
|
|
Memory::MoveAssignItems(B, A, 2);
|
|
|
|
cout << (Memory::CompareItems(A, B, 2) ? "True" : "False") << endl;
|
|
|
|
|
|
|
|
Memory::DefaultConstructItems<int32>(C, 2);
|
|
|
|
Memory::DestructItems<int32>(C, 2);
|
|
|
|
Memory::ConstructItems<int32>(C, D, 2);
|
|
|
|
Memory::CopyAssignItems(D, C, 2);
|
|
|
|
Memory::RelocateConstructItems<int32>(D, C, 2);
|
|
|
|
Memory::MoveConstructItems(D, C, 2);
|
|
|
|
Memory::MoveAssignItems(D, C, 2);
|
|
|
|
cout << (Memory::CompareItems(C, D, 2) ? "True" : "False") << endl;
|
|
|
|
|
|
|
|
cout << " --- " << endl;
|
|
|
|
|
|
|
|
delete[] A;
|
|
|
|
delete[] B;
|
|
|
|
delete[] C;
|
|
|
|
delete[] D;
|
|
|
|
|
2021-10-05 15:36:11 +00:00
|
|
|
cout << "Done!" << endl;
|
2021-09-26 15:24:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|