Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::ptr_vector::sort with c++11 lambdas
From: Michel Morin (mimomorin_at_[hidden])
Date: 2011-11-11 23:34:29


Vicente J. Botet Escriba wrote:
> is there any reason result_of couldn't use decltype when available? That is,
> could Boost define  BOOST_RESULT_OF_USE_DECLTYPE when decltype is
> supporeted?

First, (almost) all current implementation of decltype does not support N3276.
Non-N3276-decltype requires type-completeness, while traditional result_of
does not. So result_of with non-N3276-decltype is incompatible with
the traditional result_of.

We should proceed gradually even if N3276-decltype is available, because
* decltype-based result_of can break user codes with (unintended) use
  of result_of.
* Implementation of N3276-decltype might be buggy for some time.

Daniel already made a first step by updating the documentation.
The doc 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>.

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