From: Justinas V.D. (vygintas.daugmaudis_at_[hidden])
Date: 2004-04-29 14:05:19
Perhaps it's just me being inattentive or Boost.Lambda lacks some
feature I would consider quite useful. Rummaging through documentation
and source code did not turn out to be constructive.
Well, the problem is:
typename ExprT::result_type operator(ExprT expr)
return expr(/*params here*/);
Umm... We can write as follows then:
some_stl_conformant_unary_functor() // or binary, or whatever...
It would be nice to write little lambda expressions too,
std::cout << _1 // Fails miserably
The problem is that lambda expressions do not have result_type defined
although technically they are functors too (like STL functors). It would
be trivial to write little metafunction wrapper though. After all,
boost::lambda::is_lambda_functor metafunction exists but I haven't found
lambda_result_type traits or something like that. Documentation
conveniently skips through that part of implementation and code is a bit
obscure at times.
Is there a way to implement such a metafunction
boost::lambda::functor_result<T>::type that it would return result
type of lambda expression if T is lambda
expression or T::result_type if T is ordinary STL functor, or just
null_type if neither of them?
that its implementation would not turn out to be a pain in the... emm...
neck? Or perhaps this could be a part of Boost.Lambda library?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk