Boost logo

Boost :

Subject: [boost] the Boost policy for protecting against "too perfect forwarding"
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2014-04-25 10:48:03


Hi,
By "too perfect forwarding" I mean the issue described in either of the
following articles:
http://akrzemi1.wordpress.com/2013/10/10/too-perfect-forwarding/
http://flamingdangerzone.com/cxx11/2012/06/05/is_related.html
http://ericniebler.com/2013/08/07/universal-references-and-the-copy-constructo/

In short, a perfect-forwarding constructor can inadvertently become a
better match than a copy constructor when we want to make a copy.

There are two ways for protecting against it:
1. enable_if -- to disable the unwanted overloads
2. Add additional constructor overloads.

(1) appears cleaner, but some compilers might not support SFINAE.

My question is if there is a consensus in Boost how to approach this
problem. Is Boost supposed to support compilers w/o SFINAE? (It looks so,
because we have macro BOOST_NO_SFINAE.

I can see Boost.Any just uses SFINAE for this purpose without any check.

Are there any compilers supported by Boost that have rvalue references but
no SFINAE?

Regards,
&rzej


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