Boost logo

Boost :

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

Stephan T. Lavavej wrote:
> [Steven Watanabe]
> > So is it more important to match std::function or to avoid breaking
> > existing code?
> That's your call. Over in the Standard Library, I ruthlessly deliver
> conformance and breaking changes (especially at compile-time like this).

The problem here is that on compilers that don't support rvalue references,
the code works, and on those that do, it fails. It's a bit of an annoyance.

It should be noted, however, that the problem in the original example is
also caused by boost::bind not doing perfect forwarding, so perhaps this is
what needs to be fixed. But I'm not sure that now (between beta an release)
is the time to do that.

> Note that this affects signatures like function<void (unique_ptr<int>)>,
> which work for std::function. In general, my motto is that INVOKE is
> scary, so I should do exactly what it says, so INVOKE gets all the blame
> if users are unhappy. (It's actually well-designed, just deeply scary.)

It's not INVOKE that causes the problem, but the
std::forward<ArgTypes>(args)... part.

If you INVOKE( f, args..., R ) instead, as boost::function used to do, it
will work.

Boost list run by bdawes at, gregod at, cpdaniel at, john at