Subject: Re: [boost] Boost 1_58_0_b1_rc2 is available for testing
From: Peter Dimov (lists_at_[hidden])
Date: 2015-03-17 18:58:09


Steven Watanabe wrote:

> One of these has to fail:
>
> int ref(int&);
> int rref(int&&);
>
> boost::function<void(int)> f1(&ref);
> boost::function<void(int)> f2(&rref);
>
> I don't think there's any strong reason to support one over the other, so
> it's probably best to allow f1, since it used to be supported before
> rvalue references.

The rationale for supporting f1 was that

void f1( int x )
{
    return ref( x );
}

works, and this is what boost::function was, conceptually, trying to
provide.

Of course, this decision to allow f1(&ref) was made before rvalue
references. Nowadays one would argue that rref should be free to pilfer the
argument for efficiency.