Boost logo

Boost :

Subject: Re: [boost] [result_of] now uses decltype on release branch
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-09-08 12:02:12

Daniel Walker wrote:
>> Not a small number of people have complained about the disability of
>> std/boost::result_of for SFINAE.
> Where has this come up before? I just don't remember. It would be
> interesting to know the history of this problem.

I learned this problem from this blog post:
(Note: written in Japanese )
This post listed defects in FDIS. One of them is that some meta-functions
(std::result_of and common_type) cannot be used for SFINAE.

On gcc bugzilla, Paolo Carlini said the following
( )

  Unfortunately, I don't think you can use std::result_of for sfinae purposes,
  if I understand correctly it's a well know annoyance which you have to
  overcome by open coding with std::declval.

  Eg, if you simply open the <functional> header you will find plenty of
  decltype( std::declval... for sfinae, which cannot be replaced by a concise

Also, quick google finds an old boost-user ML post:
( )

  From: Ian McCulloch
  Subject: Re: result_of tutorial
  Date: 2005-03-17 08:22:29 GMT

  Thanks Peter, I think I understand how it works now. Unfortunately, the
  lack of SFINAE is a real showstopper for me. I want to write functions

  template <typename T>
  typename result_of<negate(T)>::type
  operator-(T const& x)
     return negate()(x);

  but the lack of SFINAE here makes boost::result_of essentially useless for
  this. But I imagine it won't be difficult to make a new version based on
  boost that would work.


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