Boost logo

Boost :

Subject: Re: [boost] [Fit] formal review ends 20th March.
From: paul Fultz (pfultz2_at_[hidden])
Date: 2016-03-23 00:07:15


> On Tuesday, March 22, 2016 8:10 PM, Gavin Lambert <gavinl_at_[hidden]> wrote:
> > 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)?

Yes that code is valid.
>
> 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.
>
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk