So the lambda functions are implemented in a way that only really works with templates and you have to explicitly pass scope? I don't really write C++ "natively," but this seems awkward to me, particularly vis-a-vis Apple's implementation of blocks in C. Does it look better to anyone who has a better handle on the feel of idiomatic C++?
I've been using them for a while now (gcc has support) and they're not awkward. The ability to specify scope is actually rather nice and most of the time you'll either leave the scope empty with [] or pass everything in by value [=] or reference [&]. The return type of the lambda function is also usually detectable by the compiler so you only need to specify it rarely.
Requiring the use of templates (or std::function) is how closures work in C++ already. The new lambda syntax is just a (much) easier way to create closures, so it suffers from some of the same problems. I've never found wrapping things in std::function to be much of a problem, though.
You can "explicitly" pass all variables in the containing scope with [=] or [&], so it's more of an optional annotation than a requirement.
There's no such thing as idiomatic C++. The language is so huge and complex that all successful teams I've worked with that use it have selected a subset to use as part of their coding standard. In each case those subsets were different
I thought the same thing when I starting working with the new standard, but I've really grown to enjoy a lot of the new features, specifically the new pointer types, rvalue references, initializer lists, variadic templates, and better support for functional programming via binds and lambdas. C++0x really does fix a lot of things that were broken on awkward previously, while also expanding support for memory and speed constrained systems via things like std::array. For me, this stuff breaths new life into the language.
I may be in the minority, but I like header files. Interface => Implementation, enforced at the file level. Add Obj-C's #import macro and they even look reasonable!
http://en.wikipedia.org/wiki/C1X is the new 'C' draft standard, I think that the C++ guys figured they'd be ready a bit earlier than this. They might name it C++09 to save face.
[+] [-] chc|15 years ago|reply
[+] [-] bff|15 years ago|reply
[+] [-] plorkyeran|15 years ago|reply
You can "explicitly" pass all variables in the containing scope with [=] or [&], so it's more of an optional annotation than a requirement.
[+] [-] aidenn0|15 years ago|reply
[+] [-] faragon|15 years ago|reply
P.S. I've working with C++ for more than 10 years.
[+] [-] bff|15 years ago|reply
[+] [-] jey|15 years ago|reply
[+] [-] exit|15 years ago|reply
[+] [-] jonhohle|15 years ago|reply
[+] [-] lanstein|15 years ago|reply
[+] [-] jacquesm|15 years ago|reply
[+] [-] ori_b|15 years ago|reply
[+] [-] inodeman|15 years ago|reply
[+] [-] ben_straub|15 years ago|reply