I have the following piece of code, as an example dec_proxy attempts to reverse the effects of the increment operator upon the type that is executed in a complex function call f
Taking Stephen's advice, you should look at the answer to How come a non-const reference cannot bind to a temporary object? and simply add a member function that returns a reference dec_proxy
, e.g.:
dec_proxy &ref() { return *this; }
and call foo
:
foo(
dec_proxy(i).ref(),
dec_proxy(j).ref(),
dec_proxy(k).ref());
I'm pretty sure that compiles.