C++0x in Visual Studio 10

Visual Studio 10 has been released as beta version (named CTP for Community Technology Preview) and its compiler has some parts of C++0x implemented. The best feature: The auto keyword. I really love it. No more typing the foo<bar::baz>::iterator part in
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?

for_each(v.begin(), v.end(), [=](int& r) mutable {
     const int old = r;
     r *= x * y;

But anyway, nice.

nine comments, already:

Thanks, downloading
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

Useful example of lambda usage: http://cschleiden.spaces.live.com/blog/c..
CSchleiden (link) - 02 11 08 - 01:46

Remember personal info?
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.