diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-03-28 17:32:59 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-03-28 17:32:59 +0000 |
commit | 2c9f9435496bd57ba69ad9a4ff5095ce6d26dd14 (patch) | |
tree | dfdbd08e3798cc0b33b0de784a31af94769f0dd4 | |
parent | Add missing BOOST_ASSERT include (diff) | |
download | libadhocutil-2c9f9435496bd57ba69ad9a4ff5095ce6d26dd14.tar.bz2 libadhocutil-2c9f9435496bd57ba69ad9a4ff5095ce6d26dd14.tar.xz libadhocutil-2c9f9435496bd57ba69ad9a4ff5095ce6d26dd14.zip |
Add more C++ special member helpers
-rw-r--r-- | libadhocutil/c++11Helpers.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libadhocutil/c++11Helpers.h b/libadhocutil/c++11Helpers.h index e34fcf8..9826189 100644 --- a/libadhocutil/c++11Helpers.h +++ b/libadhocutil/c++11Helpers.h @@ -10,9 +10,16 @@ #define SPECIAL_MEMBERS_MOVE(T, type) \ T(T &&) noexcept = type; \ T & operator=(T &&) noexcept = type +#define SPECIAL_MEMBERS_MOVE_RO(T) \ + T(const T &) = delete; \ + T(T &&) noexcept = default; \ + SPECIAL_MEMBERS_ASSIGN(T, delete) #define SPECIAL_MEMBERS_COPY(T, type) \ T(const T &) = type; \ T & operator=(const T &) = type +#define SPECIAL_MEMBERS_COPY_RO(T) \ + SPECIAL_MEMBERS_CONS(T, default); \ + SPECIAL_MEMBERS_ASSIGN(T, delete) #define SPECIAL_MEMBERS_DEFAULT(T) \ SPECIAL_MEMBERS_COPY(T, default); \ SPECIAL_MEMBERS_MOVE(T, default) |