[result_of, phoenix] Inconsistency between result_of and tr1_result_of

To support nullary-callable polymorphic function objects in C++03 `result_of`, we have to specialize `result_of` for the zero-argument case. (If we don't provide specializations, the type determined by C++03 `result_of` for zero-argument function calls is defaulted to void. See the rationale in N1454.) Library authors have implemented the specialization for `result_of` to support the zero-argument case. But, in most cases, they have not specialized `tr1_result_of`. I checked a few Boost libraries: * Boost.Phoenix and Boost.Functional/Forward Only `result_of` is specialized; `tr1_result_of` is not specialized. (* Boost.Lambda Neither `result_of` nor `tr1_result_of` is specialized. So `result_of` and `tr1_result_of` for nullary function calls always evaluate to `void`.) This results in inconsistency between `result_of` and `tr1_result_of`. For example, boost::result_of< decltype(boost::phoenix::val(3))() >::type evaluates to `int const&`. But boost::tr1_result_of< decltype(boost::phoenix::val(3))() >::type evaluates to `void`. Shouldn't we provide specializations for both `result_of` and `tr1_result_of` to make result_of and tr1_result_of equivalent? (Additional question: Should we avoid the specialization of result_of when we use decltype-based result_of?) Regards, Michel

On 5/16/2012 5:15 AM, Michel Morin wrote: <snip>
Shouldn't we provide specializations for both `result_of` and `tr1_result_of` to make result_of and tr1_result_of equivalent?
Yes. Can you file bug reports?
(Additional question: Should we avoid the specialization of result_of when we use decltype-based result_of?)
Probably. More bug reports, please! :-) -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
Shouldn't we provide specializations for both `result_of` and `tr1_result_of` to make result_of and tr1_result_of equivalent?
Yes. Can you file bug reports?
(Additional question: Should we avoid the specialization of result_of when we use decltype-based result_of?)
Probably. More bug reports, please! :-)
Done. [Add tr1_result_of specialization and avoid specialization of decltype-based result_of] * Functional/Forward https://svn.boost.org/trac/boost/ticket/6909 * Fusion https://svn.boost.org/trac/boost/ticket/6910 * Phoenix V3 https://svn.boost.org/trac/boost/ticket/6911 * Phoenix V2 https://svn.boost.org/trac/boost/ticket/6912 [Avoid specialization of decltype-based result_of] * Proto https://svn.boost.org/trac/boost/ticket/6913 [Feature request: Add result_of and tr1_result_of specializations for nullary function calls] * Lambda https://svn.boost.org/trac/boost/ticket/6914 Regards, Michel
participants (2)
-
Eric Niebler
-
Michel Morin