Boost logo

Boost Users :

Subject: [Boost-users] [lambda] helping lambda to deduce return type and then avoid 'ret<T>'
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-05-24 16:39:27


Hi,
 the lambda manual says: "The return type deduction system may not be
able to deduce the return types of some user defined operators or bind
expressions with class objects. A special lambda expression type is
provided for stating the return type explicitly and overriding the
deduction system. To state that the return type of the lambda functor
defined by the lambda expression e is T, you can write:"

and indeed for even very simple arithmetic user-defined classes (for
example boost.units quantities) the lambda expression is poluted with
many many ret<T> statements,
for example

 _1*_1/(_1+x)/(_1-x)

becomes

 ret<anothertype>(ret<usertype>(_1*_1)/
ret<othertype>(ret<usertype>(_1+x)/ret<usertype>(_1-x)));

the question is, is there a way to help lambda library to help
deducing the return type to avoid the repeated use of ret<T>.

Thank you,
Alfredo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net