This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CTest { | |
public: | |
CTest() { puts("ctor"); } | |
CTest(CTest &&rrRight) { puts("ctor-m"); } // move | |
CTest & operator=(CTest &&rrRight) noexcept { puts("assign-m"); return *this; } // move | |
CTest & operator=(CTest &rRight) { puts("assign"); return *this; } // copy (일반적으로 딥카피) | |
}; | |
auto createTest1 = []() -> CTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 이동 생성자/연산자는 RVO 및 int x(int())의 버그를 고려하고 학습/테스트 해야 한다. | |
class CTest { | |
public: | |
CTest() { puts("ctor"); } | |
CTest(const CTest &rRight) { puts("ctor-c"); } // copy | |
CTest(CTest &&rrRight) { puts("ctor-m"); } // move | |
CTest & operator=(const CTest &rRight) { puts("assign"); return *this; } // copy (일반적으로 딥카피) | |
CTest & operator=(CTest &&rrRight) noexcept { puts("assign-m"); return *this; } // move | |
static CTest Create_NoRVO(const int n) { return n ? CTest() : CTest(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int i(int()); // int i( int a ) 함수선언으로 인식. | |
i = 2; // COMPILE ERR, int 변수가 아니라서 대입불가 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SData | |
{ | |
int m_Size; | |
char *m_Buf; | |
SData() | |
: m_Size(0), m_Buf(nullptr) | |
{ | |
puts("ctor"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CRValue | |
{ | |
public: | |
void f() const && { puts("&&"); } | |
void f() const & { puts("& or inst"); } | |
}; | |
CRValue inst; | |
CRValue &rInst = inst; | |
inst.f(); // & or inst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FMyTasks | |
{ | |
private: | |
using TSinglecasterArray = TArray<FSimpleDelegate>; | |
TSinglecasterArray m_Singlecasters; | |
public: | |
void AddDelegate(FSimpleDelegate &&rvDelegate) | |
{ | |
m_Singlecasters.Add(rvDelegate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
class FScopedExecuter | |
{ | |
private: | |
using T_FUNC = std::function<void(void)>; | |
T_FUNC m_Func; | |
public: | |
FScopedExecuter(T_FUNC &&rvFunc) : m_Func(rvFunc) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma warning(disable : 4710 4514) | |
#include <vector> | |
#include <functional> | |
struct SMemHolder | |
{ | |
char *m_pBuf; | |
SMemHolder() : m_pBuf(nullptr) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UCLASS() | |
class FORTHEDAYSANDBOX_API UMyObject : public UObject | |
{ | |
GENERATED_BODY() | |
public: | |
virtual void BeginDestroy() override; | |
}; | |
//------------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma warning(disable : 4710 4514) | |
#include <stdio.h> | |
#include <errno.h> | |
class CMutable | |
{ | |
private: | |
mutable int m_Val = 0; | |
public: |