Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Deducing this, i wish: my current approach just uses a macro to stamp out all the required overloads. The quadruplication is code-generated.
#include <utility>
#define FORALL_CONSTREFS(mac) \
mac(const, &, ) mac(, &, ) mac(, &&, std::move) mac(const, &&, std::move)
class ExampleIntWrapper {
# define OVERLOADS_PLEASE(const_, ref_, move_) \
int const_ ref_ data() const_ ref_ { return move_(data_); }
int data_;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment