Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2006-04-13 18:59:28

>> auto(x){ x->first < 0 }
>>returns bool, and
>> auto(x){ x->first < 0; }
>>returns void?
> Did I say that? I didn't mean to say that.

Yes, it sounded like that was maybe what you meant (in another message
in this thread - quoted below). So what does the version with the
semi-colon return? Or would the semi-colon be a syntax error?


Yes, of course it's an expression. We make a provision that a lambda
expression can end with a simple expression in which case that is its
return value. It could be made into a statement and a valid function
body like this:

     auto(x) { x->first < 0; }

but then such a statement normally does *not* return, and the
semicolon adds a little confusion, one more character, and nothing of

Boost list run by bdawes at, gregod at, cpdaniel at, john at