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:45:00


Daniel Walker wrote:
> Do you know of any previously proposed solutions to the SFINAE problem;
> e.g. alternative result_of implementations?

This post (Note: written in Japanese
http://d.hatena.ne.jp/iorate/20110717/1310913102 )
says that boost::result_of (and std::result_of) cannot be used for SFINAE
and presents the following implementation

  template < class , class = void >
  struct result_of_aux
  {};

  template < class F, class ...Args>
  struct result_of_aux<F(Args...),
decltype(std::declval<F>()(std::declval<Args>()...), void ())>
  {
      typedef decltype(std::declval<F>()(std::declval<Args>()...)) type;
  };

  template < class Sig>
  struct result_of
    : result_of_aux<Sig>
  {};

Regards,
Michel


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