Boost logo

Boost :

Subject: Re: [boost] [result_of] Allow result_of to work with C++11 lambdas
From: Peter Dimov (lists_at_[hidden])
Date: 2013-04-27 12:40:38

Daniel Walker wrote:
> On Apr 21, 2013, at 10:36 PM, Peter Dimov <lists_at_[hidden]> wrote:
> > I can't think of a reason to ever use TR1 (and whichever version of
> > result_of) in C++11. Even less so in C++14, which will have deduced
> > return types unless the N3638 formal motion failed, and I very much hope
> > it did not.
> Agreed, and we recommend in the boost::result_of documentation that C++11
> users use std::result_of rather than boost::result_of.

I actually meant that C++11 users should use decltype directly rather than

A library that wanted to support both would do something like


#if C++11

auto f(...) -> decltype(...)


boost::result_of<...>::type f(...)


{ ... }

That's not very nice as it forces you to write everything twice, but it
keeps C++11 users isolated from anything C++03-related. In particular, it no
longer matters whether boost::result_of works with lambdas. (Well... it
could matter if decltype is not N32whatever but lambdas work fine, but
ideally, it shouldn't.)

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