Boost logo

Boost Users :

Subject: Re: [Boost-users] BOOST_RESULT_OF_USE_DECLTYPE not default on C++11 compilers
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-01-26 10:33:13


Jeremiah Willcock wrote:
> Is there a reason that the use of decltype is not on by default for
> compilers that support it, perhaps with a flag to force emulation mode
> (like Boost.Move supports)?

Aside from the type-completeness problem of old C++0x decltype,
there is another type of breakage caused by incorrect support of the
traditional result_of protocol or incorrect usage of result_of.
Some codes using Boost.Fusion or Boost.Phoenix failed to compile with
BOOST_RESULT_OF_USE_DECLTYPE. The reason for the compile error is that
many metafunctions have `struct result` but they do not have corresponding
function call operators.
   http://thread.gmane.org/gmane.comp.parsers.spirit.general/24027
   https://svn.boost.org/trac/boost/ticket/5687

So we should proceed gradually even if N3276-decltype become available.
As a first step, Daniel already made by updating the documentation.
The documentation on trunk says:
   In a future release, BOOST_RESULT_OF_USE_DECLTYPE may be enabled
   by default on compilers that support decltype, so if you use the above
   protocol please take care to ensure that the result_type and
   result<> members accurately represent the result type.
   If you wish to continue to use the protocol on compilers that
   support decltype, use boost::tr1_result_of, which is also defined
   in <boost/utility/result_of.hpp>.

The next step might be doing regression tests for all libraries that are
clients of result_of with BOOST_RESULT_OF_USE_DECLTYPE.

Regards,
Michel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net