Opened 10 years ago

Closed 10 years ago

#7311 closed Bugs (worksforme)

boost::result_of can't eval C++2011 lambda 's return type,should use C++2011 std::result_of

Reported by: anonymous Owned by: No-Maintainer
Milestone: To Be Determined Component: result_of
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

This will make boost::range 's adaptor fail. Think this code:

vector<int> v={1,2}; for (auto x : transform(v, [](int t1){return t1 + 2;})) {

cout << x << endl;

}

I didn't want use transform(v, function<int (int)>([](int t1){return t1 + 2;}))

Change History (1)

comment:1 by Michel Morin, 10 years ago

Component: utilityresult_of
Resolution: worksforme
Status: newclosed

You can use decltype-based result_of by defining BOOST_RESULT_OF_USE_DECLTYPE. Please see the documentation.

Also note that, in the future release (i.e. Boost 1.52), decltype-based result_of will be automatically enabled on highly C++11-compliant compilers. Currently, clang-3.1 (in a C++11 mode) is the only such compiler.

Note: See TracTickets for help on using tickets.