Sunday, June 5, 2011 [Tweets] [Favorites]

Objective-C Blocks vs. C++0x Lambdas

Mike Ash:

By allowing each lambda to specify how it captures things, the C++0x system allows more flexibility. With Objective-C blocks, a given variable is either __block or it's not. Every block which captures that variable must capture it in the same way. C++0x lambdas allow each lambda to make its own choice on how to capture. The mutable keyword even allows them to capture by value but retain the ability to change the copied value internally. The downside is considerably increased complexity.


Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment