Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2004-03-08 08:07:04


David Abrahams <dave_at_[hidden]> writes:

| Gabriel Dos Reis <gdr_at_[hidden]> writes:
|
| > In -a- model I discussed a while ago with the second author of
| > decltype/auto proposal, lambdas are unnamed constants that can be
| > implemented by local classes. The body of the lambda would be
| > forwarded-to by the appropriate overload of the call operator,
| > i.e. your example would be
| >
| > foo: () -> auto {
| > int i;
| >
| > struct xxx {
| > operator(): (int x) -> auto { return i + x; }
| > };
| > };
|
| Is foo missing a return statement?

Yes: It is missing

     return xxx();

Thanks!

[...]

| > Note that I want the lambdas to be constants, in particular I would
| > like to be able to use them as template arguments. Note also the type
| > inference that can refer to local classes :-)
|
| Sounds lovely ;-)

:-) How else would I have my expression templates without turning C++
into Haskell? ;-)

-- Gaby


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk