Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Copy elision sample modern C++
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> #define _(X) std::cout<<"\""#X<<"\"\t==>\t"; X #define I_LIKE_TO_MOVE_IT #undef I_LIKE_TO_MOVE_IT class CDog { public: CDog() = default; CDog(const CDog&){std::cout<<"copied\n";} CDog& operator=(CDog& other){std::cout<<"copied =\n"; return other;} #ifdef I_LIKE_TO_MOVE_IT CDog(CDog&&){std::cout<<"moved\n";} CDog& operator=(CDog&& other){std::cout<<"moved =\n"; return std::move(other);} #endif virtual ~CDog(){} }; int main() { CDog& myDog = CDog(); CDog& yourDog = CDog(); _(yourDog = std::move(myDog);) _(myDog = CDog(std::move(yourDog));) return 0; }
run
|
edit
|
history
|
help
0
decltype_lambda
ToString library for C++
C++ quine
복소수 클래스 생성하기
Stringify enum
#26.fix
Chord Note Finder
Visual C++ template instantiation
cv2
#30.2