Last active
February 27, 2022 21:17
-
-
Save Unknown6656/f2f7dc5038f3828a088373d510051829 to your computer and use it in GitHub Desktop.
CPP IS FUCKING RETARDED
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
// Use this include if you have a class with const members and have | |
// trouble using the assign or copy constructor. Thank me later. | |
// | |
// Example: | |
// class A { | |
// const int X, Y; | |
// | |
// A() : A(0, 0) { } | |
// A(int x, int y) : X(x), Y(y) { } | |
// | |
// CPP_IS_FUCKING_RETARDED(A); | |
// }; | |
// | |
#pragma once | |
#define CPP_IS_FUCKING_RETARDED(x) inline x& operator =(const x& value) noexcept { return this == &value ? *this : *new(this)x(value); } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment