
Jeremiah Willcock wrote:
On 1/25/2012 6:42 PM, Jeremiah Willcock wrote:
At least on GCC 4.6 in C++0x (C++11) mode, BOOST_RESULT_OF_USE_DECLTYPE is not set by default, preventing classes such as boost::transform_iterator from working on built-in lambda expressions. <snip> So far I'm using a -D on the compile line to turn it on;
BOOST_RESULT_OF_USE_DECLTYPE might break some codes of Boost,
so how about wrapping a function object without tr1 result_of support into
a tr1 function object (i.e. a function object with tr1 result_of support)?
This approach enables us to use transform_iterator with C++11 lambda
without defining BOOST_RESULT_OF_USE_DECLTYPE.
I just wrote a code which wraps into a tr1 function object. Additionally,
I made wrapped functors to be DefaultConstructible and CopyAssignable.
(Since C++11 lambda is not DefaultConstructible nor CopyAssignable,
transform_iterator with it is not a "decent" iterator. Like oven::regular,
the wrapper solves this problem.)
Here is a code:
(Complete code is attached in this mail)
template <typename Func>
class tr1_functor
{
public:
// tr1 result_of support
template <typename Sig>
struct result;
template