Hi!
I'm currently refreshing my C++ skills and was wondering if it is possible to assign something to *this.
I know assigning to this is forbidden, but can't find the same information for my case.
An example:
class Foo {
int x;
public:
Foo(int x) : x(x) {}
Foo incr() { return Foo(x+1); }
void incr_() { (*this) = incr(); }
};
Edit: corrected incr()'s return type from void to Foo.