On 23/03/2016 13:33, paul Fultz wrote:
This doesn't really matter. `reference_wrapper` has a call operator that is only const. Having a non-const overload for `reference_wrapper` would imply that the function could change what `reference_wrapper` points to, but it can't. So there is no reason to have a non-const overload.
Well, I'm mostly using boost::reference_wrapper at the moment, which lacks a call operator, so boost::bind does have to explicitly unwrap it (though it does do this internally, so user code doesn't care). But that's good to know; I hadn't noticed that the C++11 standard had introduced this.
Same applies to using `fit::indirect(&f)`.
So, you're saying that this is valid code (noting lack of const)? struct F { F() : value(0) {} void operator()(int a) { value += a; } int value; } f; fit::indirect(&f)(15); fit::indirect(&f)(2); assert(f.value == 17); If so, then that satisfies my concern.