[cfe-dev] blocks and lambdas
rjmccall at apple.com
Mon Feb 7 15:40:33 PST 2011
On Feb 7, 2011, at 11:18 AM, James Gregurich wrote:
> What is to be the relationship between Apple's blocks standard and C++0x lambda functions? Are these things features going to be integrated or interchangeable in clang?
Block pointers should already work as function objects, although it's not totally transparent because (1) block pointer types aren't class types, which is detectable, and (2) copying a block pointer around isn't safe if it hasn't been Block_copy'ed, whereas copying a lambdas should work fine if it doesn't capture anything on the stack by reference.
It would certainly be a neat hack to have an implicit conversion operator from lambda types to the appropriate block type; whether it would copy the block by value or reference is an interesting question.
More information about the cfe-dev