basically how to make following code compile?
I know it failed because compiler was trying to evaluate something like ([](int &i){})(0) but how to s
([](int &i){})(0)
Two ways. First:
using TResult = decltype(f(_e));
or second:
using TResult = typename std::result_of::type;
Your code implicity says that the TElement is a temprary/rvalue. The & above makes them lvalues.
&