Created
July 6, 2020 22:21
-
-
Save rileylev/22eb94a9919786dd7f3c8dc569b9b7dd to your computer and use it in GitHub Desktop.
Deducing this, i wish: my current approach just uses a macro to stamp out all the required overloads. The quadruplication is code-generated.
This file contains hidden or 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 <utility> | |
#define FORALL_CONSTREFS(mac) \ | |
mac(const, &, ) mac(, &, ) mac(, &&, std::move) mac(const, &&, std::move) | |
class ExampleIntWrapper { | |
public: | |
# define OVERLOADS_PLEASE(const_, ref_, move_) \ | |
int const_ ref_ data() const_ ref_ { return move_(data_); } | |
FORALL_CONSTREFS(OVERLOADS_PLEASE) | |
private: | |
int data_; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment