foo<bar::baz>::iterator xy = something.begin();
The Visual C++ Team blog also has a very nice post explaining the new features, especially lamdas in detail. A feature which I still don't like very much, it is quite sensless IMO because it only adds complexity to the language without adding a real new feature, you can emulate lamdas anyway using templates. Or is it obvious what this code does?
But anyway, nice.
nine comments, already:
doc - 29 10 08 - 19:05
ad lambdas: actually without them the whole algorithms header really doesn’t make sense. the boost lambdas are a workaround, nothing more (there are tons of expressions you cannot reasonably write using them).
I do not think foreach is the most reasonable example, copy_if etc. might make more sense. lambdas may even allow the suggested functional style (suggested by the STL design) to work, using a few templates for representing lazily filtered collections, for example. the syntax is not particularily nice, ok, but not too unreasonable.
the feature I like best (don’t know if its in the CTP) is ‘concepts’. I think non-concept-based templates (whilst being necessary for learning) never were a good idea, and concepts enable much better compiler diagnostics and much improved contract checking.
regarding useless complexity in the language: c++fqa, anybody?
xaos - 29 10 08 - 19:23
Do they provide a “strict” C++ mode in Visual Studio 10 ?
Hervé () (link) - 29 10 08 - 23:02
Did they ever?
zutuk - 30 10 08 - 10:13
Lambdas are definintely useful in their place, to stop you having to define structs just to provide a custom operator for a std::sort call or similar.
steve () (link) - 30 10 08 - 10:18
Shame, the link doesn’t work anymore
Parsa () - 30 10 08 - 21:19
yep, they removed it because the image contained some private debugging symbols of the windows source code :)
niko - 31 10 08 - 15:23
Ah! A fix! http://blogs.msdn.com/othmane/archive/20..
Parsa () - 01 11 08 - 13:05