<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx</link><description>Part 1 of this series covered lambdas , auto , and static_assert . Part 2 of this series covered rvalue references , which enable move semantics and perfect forwarding . Today, I'm going to talk about decltype , which allows perfect forwarding functions</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>decltype: C++0x Features in VC10, Part 3 | Microsoft Share Point</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9562946</link><pubDate>Wed, 22 Apr 2009 22:01:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9562946</guid><dc:creator>decltype: C++0x Features in VC10, Part 3 | Microsoft Share Point</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://microsoft-sharepoint.simplynetdev.com/decltype-c0x-features-in-vc10-part-3/"&gt;http://microsoft-sharepoint.simplynetdev.com/decltype-c0x-features-in-vc10-part-3/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9563678</link><pubDate>Thu, 23 Apr 2009 03:57:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9563678</guid><dc:creator>blah</dc:creator><description>&lt;p&gt;Would decltype(Forward&amp;lt;T&amp;gt;(T()) + Forward&amp;lt;U&amp;gt;(U())) work as a preceding return type?&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9563768</link><pubDate>Thu, 23 Apr 2009 05:00:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9563768</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;No, because T and U might not have default constructors.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9564325</link><pubDate>Thu, 23 Apr 2009 12:16:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9564325</guid><dc:creator>KristofU</dc:creator><description>&lt;p&gt;Couldn't there be a default for the auto keyword in this case where the return type of the returned expression is used? Instead of having to essentially repeat the code.&lt;/p&gt;
&lt;p&gt;Something like this :&lt;/p&gt;
&lt;p&gt;template &amp;lt;typename T, typename U&amp;gt;&lt;/p&gt;
&lt;p&gt;auto operator()(T&amp;amp;&amp;amp; t, U&amp;amp;&amp;amp; u) const -&amp;gt; decltype(__default__) &lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; return forward&amp;lt;T&amp;gt;(t) * forward&amp;lt;U&amp;gt;(u);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9565297</link><pubDate>Thu, 23 Apr 2009 22:00:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9565297</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;That was considered, but dropped between N1607 (&lt;a rel="nofollow" target="_new" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1607.pdf"&gt;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1607.pdf&lt;/a&gt;) and N1705 (&lt;a rel="nofollow" target="_new" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1705.pdf"&gt;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1705.pdf&lt;/a&gt;) due to insufficient support from members of the Evolution Working Group. See N2869 (&lt;a rel="nofollow" target="_new" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2869.html"&gt;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2869.html&lt;/a&gt;) for the whole sequence of papers from decltype's evolution.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9566522</link><pubDate>Fri, 24 Apr 2009 14:05:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9566522</guid><dc:creator>Leo Davidson</dc:creator><description>&lt;p&gt;This is a very long comment so I've split it into four parts: Two question parts, then some thoughts / rambling, and finally a thank-you. :-) &lt;/p&gt;
&lt;p&gt;** Null-reference trick **&lt;/p&gt;
&lt;p&gt;&amp;quot;Technically, decltype(forward&amp;lt;T&amp;gt;(*static_cast&amp;lt;T *&amp;gt;(0)) + forward&amp;lt;U&amp;gt;(*static_cast&amp;lt;U *&amp;gt;(0))) could go on the left, but that's an abomination.&amp;quot;&lt;/p&gt;
&lt;p&gt;I agree that is ugly.&lt;/p&gt;
&lt;p&gt;When you say you could use that trick to avoid naming particular variables, you mean in that specific example and not in general, right?&lt;/p&gt;
&lt;p&gt;As I understand things, the trick doesn't preserve the lvalue/rvalue-ness of the particular variables, which could be important in determining the return type, so it won't always work. (It works in this example because the lvalue/rvalue-ness isn't important, assuming a typical operator*.)&lt;/p&gt;
&lt;p&gt;OTOH, if you could always use the trick then you could have something like std::forward which does it and hides the ugliness.&lt;/p&gt;
&lt;p&gt;** What if the variable names vary? **&lt;/p&gt;
&lt;p&gt;Looking at the examples in this post again makes me wonder, what if the return statement doesn't always use the same variables? For example, what goes in place of &amp;quot;t???&amp;quot; here:&lt;/p&gt;
&lt;p&gt;template &amp;lt;typename T&amp;gt;&lt;/p&gt;
&lt;p&gt;auto operator()(T&amp;amp;&amp;amp; t1, T&amp;amp;&amp;amp; t2) const&lt;/p&gt;
&lt;p&gt;-&amp;gt; decltype(forward&amp;lt;T&amp;gt;(t???) * forward&amp;lt;T&amp;gt;(t???))&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;if (t1 &amp;gt; t2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return forward&amp;lt;T&amp;gt;(t1) * forward&amp;lt;T&amp;gt;(t1);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return forward&amp;lt;T&amp;gt;(t2) * forward&amp;lt;T&amp;gt;(t2);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Presumably, if the code will compile at all, then it doesn't matter which permutation of t1 and t2 you use to fill in the two t???. And if the lvalue/rvalue-ness of t1 and t2 are not the same, and the operator* is such that it matters, then the code won't compile because the two return statements will have different types. (Or the return statements' results will be coerced into whatever type the decltype specifies.)&lt;/p&gt;
&lt;p&gt;Am I thinking along the right lines, or completely confused?&lt;/p&gt;
&lt;p&gt;** Thoughts **&lt;/p&gt;
&lt;p&gt;It's quite odd that two &amp;quot;T&amp;amp;&amp;amp;&amp;quot; in the same context can be different despite being written exactly the same. It's like we have hidden meta-types now. :-) Very useful though, when needed, and something that most people should be able to ignore most of the time.&lt;/p&gt;
&lt;p&gt;I don't mind that the equation stating the return type goes on the right. (That's consistent with the lambda stuff and presumably dictated by parsing/syntax issues squeezing these features into the existing language.) And I don't mind that we have to explicitly state the return type/equation. (Fair enough.)&lt;/p&gt;
&lt;p&gt;I feel for anyone trying to learn C++ but I would not argue against any of these additions as they solve real problems in a way which makes (non-library) code easier to read and write. Anyone learning C++ needs to realise that the aim is not to hold the entire language in your head. Almost nobody does that. There are some features you should be aware of, but not expert in, where you can re-read the relevant chapter/webpage in the rare cases you need them.&lt;/p&gt;
&lt;p&gt;It must be a bit more daunting now than it was before, but that's life. IMO, C++ has always been a language that it takes years to master, and where mastery cannot come from a book or even from mental capacity alone. You have to trip over all of the caveats with your own foot before you truly understand them. It can be horrible for beginners but it's still probably my favourite language.&lt;/p&gt;
&lt;p&gt;My main complaints about C++ could never be fixed without breaking existing code. (e.g. I hate the fact that you can get default constructors/operators without explicitly asking for them. Anything where the default may be catastrophically wrong should be opt-in, not opt-out, IMO. But it's too late to change that now.)&lt;/p&gt;
&lt;p&gt;** Thanks! **&lt;/p&gt;
&lt;p&gt;By the way, I read all three parts of this series over the last two days and I want to say thanks for describing things so well and thinking of examples that strike the right balance between complexity and abstraction*. Only the section on forwarding took me a few reads to grasp and I guess that is inherently complex and difficult to explain. I think you did a great job.&lt;/p&gt;
&lt;p&gt;(*That is to say, often when language features are described the examples are so abstract that I have to almost compile them in my head to work out what's being demonstrated. Or the examples are so complex, with so many unimportant side details, that it takes time to dig into the important bits. Your examples, OTOH, tended to be clear just from skimming the code. Nice one!)&lt;/p&gt;
</description></item><item><title>Visual Studio Links #113</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9566888</link><pubDate>Fri, 24 Apr 2009 18:36:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9566888</guid><dc:creator>Visual Studio Hacks</dc:creator><description>&lt;p&gt;My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. US ISV Developer Evangelism Team posted some links to money saving offers for ISVs when purchasing or upgrading Visual Studio or MSDN&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9567317</link><pubDate>Fri, 24 Apr 2009 23:58:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9567317</guid><dc:creator>Nicol Bolas</dc:creator><description>&lt;p&gt;&amp;quot;What if the variable names vary?&amp;quot;&lt;/p&gt;
&lt;p&gt;Since return type of a function cannot vary depending on the input data, then the operator* should resolve to the same regardless of the order that t1 and t2 are multiplied in. So it shouldn't matter.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9567534</link><pubDate>Sat, 25 Apr 2009 03:11:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9567534</guid><dc:creator>Leo Davidson</dc:creator><description>&lt;p&gt;@Nicol Bolas:&lt;/p&gt;
&lt;p&gt;&amp;quot;then the operator* should resolve to the same regardless of the order&amp;quot;&lt;/p&gt;
&lt;p&gt;The same what, is my question. The two return statements are presumably coerced into the type of the decltype statement, and there's an error if that isn't possible. That's my guess anyway, but I was wondering if the guess is correct.&lt;/p&gt;
&lt;p&gt;That is, the return type cannot vary but the type of each return statement can vary, so long as it can be turned into the return type.&lt;/p&gt;
&lt;p&gt;A bit like this (which compiles) but where the lvalue/rvalue-ness of the types varies rather than the types themselves.&lt;/p&gt;
&lt;p&gt;double test(long a, char b)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	if (a &amp;gt; b)&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		return a * a;&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;	else&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		return b * b;&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9567636</link><pubDate>Sat, 25 Apr 2009 04:26:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9567636</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;[Leo Davidson]&lt;/p&gt;
&lt;p&gt;&amp;gt; When you say you could use that trick to avoid naming particular variables, you mean in that specific example and not in general, right?&lt;/p&gt;
&lt;p&gt;It works in general, so trailing return types weren't an absolutely necessary feature. However, programmer sanity is important, which is why trailing return types were added.&lt;/p&gt;
&lt;p&gt;&amp;gt; As I understand things, the trick doesn't preserve the lvalue/rvalue-ness of the particular variables&lt;/p&gt;
&lt;p&gt;That information is contained within the deduced types T and U, and preserved by forward&amp;lt;T&amp;gt;(stuff) and forward&amp;lt;U&amp;gt;(stuff) regardless of what you give them (but you have to give them something).&lt;/p&gt;
&lt;p&gt;Something like arg&amp;lt;T&amp;gt;() could have been developed, taking nothing and returning T&amp;amp;&amp;amp; to a dereferenced null pointer (this function would be lethal to ever call - but decltype does not evaluate its expression). But instead of putting the return type on the left and teaching people to translate forward&amp;lt;T&amp;gt;(t) into arg&amp;lt;T&amp;gt;() there, putting the return type on the right and teaching people &amp;quot;give decltype exactly what you're going to return&amp;quot; is easier.&lt;/p&gt;
&lt;p&gt;&amp;gt; (It works in this example because the lvalue/rvalue-ness isn't important, assuming a typical operator*.)&lt;/p&gt;
&lt;p&gt;Although lvalueness/rvalueness doesn't generally affect operator+() and operator*(), my functors have been carefully written to respect them, including in the decltype-powered return type. &amp;nbsp;Saying decltype(t + u) would not respect lvalueness/rvalueness.&lt;/p&gt;
&lt;p&gt;&amp;gt; What if the variable names vary?&lt;/p&gt;
&lt;p&gt;Then you need to figure out some expression that has the correct type. &amp;nbsp;The function can only have one return type, after all.&lt;/p&gt;
&lt;p&gt;C++0x &amp;lt;type_traits&amp;gt; provides common_type which may be of use here.&lt;/p&gt;
&lt;p&gt;In your case, you're taking two T&amp;amp;&amp;amp;, so forward&amp;lt;T&amp;gt;(t1) * forward&amp;lt;T&amp;gt;(t1) and forward&amp;lt;T&amp;gt;(t2) * forward&amp;lt;T&amp;gt;(t2) are guaranteed to have the exact same type (same inputs, same output). &amp;nbsp;Note that taking two T&amp;amp;&amp;amp; doesn't produce perfect forwarding, and will probably trigger template argument deduction failure in many cases (where the deduced Ts differ).&lt;/p&gt;
&lt;p&gt;&amp;gt; It's quite odd that two &amp;quot;T&amp;amp;&amp;amp;&amp;quot; in the same context can be different despite being written exactly the same.&lt;/p&gt;
&lt;p&gt;I'm not sure what you're referring to.&lt;/p&gt;
&lt;p&gt;In my examples, I use operator()(T&amp;amp;&amp;amp; t, U&amp;amp;&amp;amp; u). &amp;nbsp;This allows the arguments to have different types.&lt;/p&gt;
&lt;p&gt;A different issue is that in one instantiation, T&amp;amp;&amp;amp; might actually be string&amp;amp;&amp;amp;, while in another instantiation, it might be int&amp;amp;. &amp;nbsp;This is covered in Part 2, reference collapsing, and is otherwise not fundamentally different from how in C++98/03, X&amp;amp; might actually be vector&amp;lt;int&amp;gt;&amp;amp; in one instantiation and const list&amp;lt;int&amp;gt;&amp;amp; in other (where X is deduced to be const list&amp;lt;int&amp;gt;).&lt;/p&gt;
&lt;p&gt;&amp;gt; I feel for anyone trying to learn C++ but I would not argue&lt;/p&gt;
&lt;p&gt;&amp;gt; against any of these additions as they solve real problems&lt;/p&gt;
&lt;p&gt;&amp;gt; in a way which makes (non-library) code easier to read and write.&lt;/p&gt;
&lt;p&gt;Excellently put.&lt;/p&gt;
&lt;p&gt;Also, many C++0x features are simpler than the workarounds you'd have to use in C++98/03 (if they were possible at all). &amp;nbsp;Which can make C++0x easier to learn from scratch (whereas we C++98/03 programmers had to learn the old ways, and now we have to learn the new ways on top of that).&lt;/p&gt;
&lt;p&gt;&amp;gt; By the way, I read all three parts of this series over the last two&lt;/p&gt;
&lt;p&gt;&amp;gt; days and I want to say thanks for describing things so well and&lt;/p&gt;
&lt;p&gt;&amp;gt; thinking of examples that strike the right balance between complexity and abstraction*.&lt;/p&gt;
&lt;p&gt;You're welcome! Yes, coming up with simple but plausible examples is tricky.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9573546</link><pubDate>Tue, 28 Apr 2009 16:23:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9573546</guid><dc:creator>someone</dc:creator><description>&lt;p&gt;Will VS C++ 2010 deliver real SSE3/SSE4 support (compiler optimization /arch:SSE3 ) instead of just intrinsics?&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9576130</link><pubDate>Wed, 29 Apr 2009 20:34:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9576130</guid><dc:creator>Gabest</dc:creator><description>&lt;p&gt;Ok, I don't get one thing, after all these post, who can be so obsessed with c++ to come up with all these? &lt;/p&gt;
&lt;p&gt;The reason the language is still alive today ( next to java/c#/php/... which have greater momentum, easier syntax, extendablity, etc.), because the programmer can more or less tell or check in the .asm output how it will compile to assembly and yet he does not have to write it in assembly! Anything that shifts our beloved close-to-the-metal c/c++ towards the mentioned languages don't have much &amp;quot;market value&amp;quot; because that area is already full of competition. &lt;/p&gt;
&lt;p&gt;I say just keep improving the code generator, add sse/avx/larrabee support, smarter intrinsic translationm, and of course less ICE :P&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9576141</link><pubDate>Wed, 29 Apr 2009 20:42:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9576141</guid><dc:creator>Andre Vachon</dc:creator><description>&lt;p&gt;We are working on all of that too !&lt;/p&gt;
&lt;p&gt;In the coming months, we will share details about the codegen optimizations that will be part of VC10.&lt;/p&gt;
&lt;p&gt;BTW, ICEs are quite rare now. &amp;nbsp;If you find some, please report them back to us!&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9576391</link><pubDate>Wed, 29 Apr 2009 22:59:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9576391</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;Gabest:&lt;/p&gt;
&lt;p&gt;Please note that these features follow C++'s spirit of staying close to the metal while providing modern abstractions.&lt;/p&gt;
&lt;p&gt;* Lambdas compile into function objects which benefit from inlining. This is superior to library machinery (like bind() and mem_fn()) which is complicated enough to defeat the inliner.&lt;/p&gt;
&lt;p&gt;* auto, static_assert, and decltype are purely compile-time features. They impose no overheads on generated code.&lt;/p&gt;
&lt;p&gt;* Rvalue references automatically replace unnecessary dynamic memory allocations with instantaneous pointer twiddling. C++0x mostly eliminates C++98's biggest overhead compared to C, its tendency to perform unnecessary copies.&lt;/p&gt;
&lt;p&gt;The compiler is divided into a &amp;quot;front-end&amp;quot; (FE) and &amp;quot;back-end&amp;quot; (BE). Summarizing how they work, the FE parses C++ while the BE generates assembly. These C++0x Core Language features are FE features, unrelated to BE features like code generation, intrinsics, and so forth. FE optimizations like rvalue references and BE optimizations like smarter code generation happily coexist with each other. Also, completely different developers work on the FE and BE, so you don't have to worry that time spent implementing lambdas is somehow taking time away from improving code generation, because it's not.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9582381</link><pubDate>Fri, 01 May 2009 16:57:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9582381</guid><dc:creator>AlisdairM</dc:creator><description>&lt;p&gt;To answer a comment above: Wouldn't it be nice to deduce the return type for 'simple' functions, in just the same way that lambda is required to?&lt;/p&gt;
&lt;p&gt;template&amp;lt; typename T, typename U &amp;gt;&lt;/p&gt;
&lt;p&gt;auto plus( T t, U u ) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp;return t + u;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;As Steven says, this was considered early in the C++0x cycle, and ultimately rejected. &amp;nbsp;However, it may yet return as part of the last ongoing piece of work on this part of the standard, see &lt;a rel="nofollow" target="_new" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2825.html"&gt;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2825.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now I don't want to talk up the chances of success at this point! &amp;nbsp;The paper proposes chaning the auto keyword (in new function declarations) to [] so that functions and lambda have a similar syntax. &amp;nbsp;Essentially, anything that is 'callable' is introduced by square brackets, and there is no difference between a regular function, and a lambda expression with an empty capture list (meaning you can use lambda for callbacks into many Windows APIs!)&lt;/p&gt;
&lt;p&gt;The problem is that many consider this syntax ugly, and we will shortly have two popular compilers shipping with the auto syntax.&lt;/p&gt;
&lt;p&gt;So the idea is not dead yet, but will probably be decided one way or the other at the next standards meeting in July.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9582414</link><pubDate>Fri, 01 May 2009 17:13:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9582414</guid><dc:creator>longtime c++/Mfc dev</dc:creator><description>&lt;p&gt;I'm eagerly awaiting posts on the compiler back-end improvements :-)&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9599060</link><pubDate>Sat, 09 May 2009 14:57:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9599060</guid><dc:creator>Leo Davidson</dc:creator><description>&lt;p&gt;Sorry to have taken so long to reply. Really appreciate your answer, too.&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; It's quite odd that two &amp;quot;T&amp;amp;&amp;amp;&amp;quot; in the same context can be different despite being written exactly the same.&lt;/p&gt;
&lt;p&gt;&amp;gt; I'm not sure what you're referring to.&lt;/p&gt;
&lt;p&gt;I'll try to explain what I mean. Perhaps I'm just confused about how this stuff works, so anyone else reading please don't assume any of this is correct!&lt;/p&gt;
&lt;p&gt;Say you have:&lt;/p&gt;
&lt;p&gt;auto operator()(T&amp;amp;&amp;amp; t1, T&amp;amp;&amp;amp; t2) const;&lt;/p&gt;
&lt;p&gt;You might call that with two strings, but where the first string is an lvalue and the second string is an rvalue.&lt;/p&gt;
&lt;p&gt;In that case &amp;quot;T&amp;amp;&amp;amp; t1&amp;quot; and &amp;quot;T&amp;amp;&amp;amp; t2&amp;quot; have different (meta-)types.&lt;/p&gt;
&lt;p&gt;i.e. &amp;quot;T&amp;amp;&amp;amp;&amp;quot; means two different things within the same function body and its meaning can only be resolved in combination with a variable name. I assumed that's why there was no zero-argument thing like arg&amp;lt;T&amp;gt;().&lt;/p&gt;
&lt;p&gt;Or would that call simply not compile? (That sounds like what you said in your reply, but I'm not certain we're talking about the same thing.) Do the two T&amp;amp;&amp;amp; arguments have to have the same l/rvalue-ness, and you have to use a new template typename if you want to allow them to be different?&lt;/p&gt;
&lt;p&gt;If it wouldn't compile, does that mean there's no way to have a function where the two arguments must be the same type as each other, but may have different l/rvalue-ness?&lt;/p&gt;
&lt;p&gt;Either way it seems fine, on the face of it. I'm not criticising the design; just trying to understand exactly how things will work.&lt;/p&gt;
&lt;p&gt;Thanks, again, for your time!&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9604304</link><pubDate>Mon, 11 May 2009 22:44:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9604304</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;[Leo Davidson]&lt;/p&gt;
&lt;p&gt;&amp;gt; Say you have:&lt;/p&gt;
&lt;p&gt;&amp;gt; auto operator()(T&amp;amp;&amp;amp; t1, T&amp;amp;&amp;amp; t2) const;&lt;/p&gt;
&lt;p&gt;This is broken. (You can write it, but it won't be useful.) If you want perfect forwarding, you need to take T1&amp;amp;&amp;amp;, T2&amp;amp;&amp;amp;, T3&amp;amp;&amp;amp;, etc.&lt;/p&gt;
&lt;p&gt;&amp;gt; You might call that with two strings, but where the first string is an lvalue and the second string is an rvalue.&lt;/p&gt;
&lt;p&gt;&amp;gt; In that case &amp;quot;T&amp;amp;&amp;amp; t1&amp;quot; and &amp;quot;T&amp;amp;&amp;amp; t2&amp;quot; have different (meta-)types.&lt;/p&gt;
&lt;p&gt;&amp;gt; i.e. &amp;quot;T&amp;amp;&amp;amp;&amp;quot; means two different things within the same function body and its meaning can only be resolved&lt;/p&gt;
&lt;p&gt;&amp;gt; in combination with a variable name.&lt;/p&gt;
&lt;p&gt;This is incorrect. C++ (both 98/03 and 0x) doesn't work like this.&lt;/p&gt;
&lt;p&gt;In C++98/03, if I have template &amp;lt;typename C&amp;gt; void foo(const C&amp;amp; c1, const C&amp;amp; c2), and I call foo(v, l) with a vector&amp;lt;int&amp;gt; v and list&amp;lt;int&amp;gt; l, will this compile? No, because template argument deduction will fail. When you call foo(v, l), the compiler tries to figure out what C should be. The arguments are telling it that C should be vector&amp;lt;int&amp;gt; and list&amp;lt;int&amp;gt; simultaneously, which is impossible. (I am deliberately omitting other details of template argument deduction and overload resolution here.)&lt;/p&gt;
&lt;p&gt;C++0x works identically. Given template &amp;lt;typename T&amp;gt; void bar(T&amp;amp;&amp;amp; t1, T&amp;amp;&amp;amp; t2) and bar(expression1, expression2), either expression1 and expression2 cause the same T to be deduced (in which case compilation succeeds), or they don't (in which case compilation fails).&lt;/p&gt;
&lt;p&gt;C++0x adds a couple of twists to template argument deduction (specifically, when matching the function parameter T&amp;amp;&amp;amp; t against the function argument X x where x is an lvalue, T is deduced to be X&amp;amp; instead of plain X), substitution (specifically, reference collapsing, where you start with T&amp;amp;&amp;amp;, substitute X&amp;amp; for T which generates X&amp;amp; &amp;amp;&amp;amp;, which then collapses to X&amp;amp;), and overload resolution, but otherwise everything works like C++98/03. Within a single instantiation, a single type like T&amp;amp;&amp;amp; never means two different things. It can mean a single slightly surprising thing (for example, X&amp;amp;), but only one.&lt;/p&gt;
&lt;p&gt;&amp;gt; Or would that call simply not compile?&lt;/p&gt;
&lt;p&gt;Bingo. VC actually generates a good compiler error for this:&lt;/p&gt;
&lt;p&gt;C:\Temp&amp;gt;type meow.cpp&lt;/p&gt;
&lt;p&gt;#include &amp;lt;iostream&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;ostream&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;string&amp;gt;&lt;/p&gt;
&lt;p&gt;using namespace std;&lt;/p&gt;
&lt;p&gt;template &amp;lt;typename T&amp;gt; void meow(T&amp;amp;&amp;amp; t1, T&amp;amp;&amp;amp; t2) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; t1 &amp;lt;&amp;lt; endl;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; t2 &amp;lt;&amp;lt; endl;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;string rv() {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return &amp;quot;kittens&amp;quot;;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;int main() {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;string lv(&amp;quot;fluffy&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;meow(lv, rv());&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;C:\Temp&amp;gt;cl /EHsc /nologo /W4 meow.cpp&lt;/p&gt;
&lt;p&gt;meow.cpp&lt;/p&gt;
&lt;p&gt;meow.cpp(18) : error C2782: 'void meow(T &amp;amp;&amp;amp;,T &amp;amp;&amp;amp;)' : template parameter 'T' is ambiguous&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;meow.cpp(6) : see declaration of 'meow'&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;could be 'std::string'&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;or &amp;nbsp; &amp;nbsp; &amp;nbsp; 'std::string &amp;amp;'&lt;/p&gt;
&lt;p&gt;&amp;gt; (That sounds like what you said in your reply, but I'm not certain we're talking about the same thing.)&lt;/p&gt;
&lt;p&gt;&amp;gt; Do the two T&amp;amp;&amp;amp; arguments have to have the same l/rvalue-ness, and you have to use a new template typename&lt;/p&gt;
&lt;p&gt;&amp;gt; if you want to allow them to be different?&lt;/p&gt;
&lt;p&gt;Yes.&lt;/p&gt;
&lt;p&gt;&amp;gt; If it wouldn't compile, does that mean there's no way to have a function where the two arguments&lt;/p&gt;
&lt;p&gt;&amp;gt; must be the same type as each other, but may have different l/rvalue-ness?&lt;/p&gt;
&lt;p&gt;There is a way: static_assert.&lt;/p&gt;
&lt;p&gt;C:\Temp&amp;gt;type purr.cpp&lt;/p&gt;
&lt;p&gt;#include &amp;lt;iostream&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;ostream&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;string&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;type_traits&amp;gt;&lt;/p&gt;
&lt;p&gt;using namespace std;&lt;/p&gt;
&lt;p&gt;template &amp;lt;typename T, typename U&amp;gt; void purr(T&amp;amp;&amp;amp; t, U&amp;amp;&amp;amp; u) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;static_assert(&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;is_same&amp;lt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;typename remove_reference&amp;lt;T&amp;gt;::type,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;typename remove_reference&amp;lt;U&amp;gt;::type&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;::value,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;purr(t, u) requires t and u to have identical types, &amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;but they can have different lvalueness/rvalueness.&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; t &amp;lt;&amp;lt; endl;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; u &amp;lt;&amp;lt; endl;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;string rv() {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return &amp;quot;kittens&amp;quot;;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;int main() {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;string lv(&amp;quot;fluffy&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;purr(lv, rv());&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;C:\Temp&amp;gt;cl /EHsc /nologo /W4 purr.cpp&lt;/p&gt;
&lt;p&gt;purr.cpp&lt;/p&gt;
&lt;p&gt;C:\Temp&amp;gt;purr&lt;/p&gt;
&lt;p&gt;fluffy&lt;/p&gt;
&lt;p&gt;kittens&lt;/p&gt;
&lt;p&gt;Attempting to call purr(lv, 1729); fails:&lt;/p&gt;
&lt;p&gt;C:\Temp&amp;gt;cl /EHsc /nologo /W4 purr.cpp&lt;/p&gt;
&lt;p&gt;purr.cpp&lt;/p&gt;
&lt;p&gt;purr.cpp(14) : error C2338: purr(t, u) requires t and u to have identical types, but they can have different lvalueness/rvalueness.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;purr.cpp(27) : see reference to function template instantiation 'void purr&amp;lt;std::string&amp;amp;,int&amp;gt;(T,U &amp;amp;&amp;amp;)' being compiled&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;with&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T=std::string &amp;amp;,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;U=int&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]&lt;/p&gt;
&lt;p&gt;(I'm not bothering with constness here. You can also use SFINAE to avoid a hard error.)&lt;/p&gt;
&lt;p&gt;&amp;gt; Either way it seems fine, on the face of it. I'm not criticising the design; just trying to understand exactly how things will work.&lt;/p&gt;
&lt;p&gt;Sorry for the confusion. (I myself was confused when you started talking about a construct, foo(T&amp;amp;&amp;amp;, T&amp;amp;&amp;amp;), which I hadn't presented in my posts.)&lt;/p&gt;
&lt;p&gt;I hope things make sense now.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9606744</link><pubDate>Tue, 12 May 2009 13:30:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9606744</guid><dc:creator>Leo Davidson</dc:creator><description>&lt;p&gt;Huge thanks! That explained things perfectly and has cleared up what I had misunderstood.&lt;/p&gt;
&lt;p&gt;I enjoyed the continuation of the feline theme, too. :)&lt;/p&gt;
</description></item><item><title>Beta1?</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9607945</link><pubDate>Tue, 12 May 2009 22:04:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9607945</guid><dc:creator>Jusendo</dc:creator><description>&lt;p&gt;Hey guys,&lt;/p&gt;
&lt;p&gt; So is this going to be in Beta1? and when is that supposed to be released? I was hoping tech-Ed, but &amp;nbsp;AFAIK, no beta 1 are being haded out.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9608022</link><pubDate>Tue, 12 May 2009 22:54:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9608022</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;[Jusendo]&lt;/p&gt;
&lt;p&gt;&amp;gt; So is this going to be in Beta1?&lt;/p&gt;
&lt;p&gt;Yes. VC10 Beta 1 will contain lambdas, auto, static_assert, rvalue references, decltype, and our updated Standard C++ Library implementation.&lt;/p&gt;
&lt;p&gt;&amp;gt; and when is that supposed to be released?&lt;/p&gt;
&lt;p&gt;Magic 8 Ball says: Better not tell you now.&lt;/p&gt;
</description></item><item><title>VC 10: Stephan T. Lavavej and Damien Watkins - Inside STL</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9633984</link><pubDate>Thu, 21 May 2009 19:45:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9633984</guid><dc:creator>ComponentGear.com Feed</dc:creator><description>&lt;p&gt;Visual Studio 2010 Beta 1 introduces a number of exciting new features for the C++ developer as we include&lt;/p&gt;
</description></item><item><title>How to make this feature work in beta1?</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9634902</link><pubDate>Fri, 22 May 2009 12:11:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9634902</guid><dc:creator>Ge yong</dc:creator><description>&lt;p&gt;I installed beta1 &amp;amp; create a native console project to try new features.&lt;/p&gt;
&lt;p&gt;auto: works.&lt;/p&gt;
&lt;p&gt;decltype, lambda: doesn't work. I copied the code here &amp;amp; let IDE to compile (not from command line), but failed.&lt;/p&gt;
&lt;p&gt;Do I foget to do to some configuration?&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9634965</link><pubDate>Fri, 22 May 2009 13:16:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9634965</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;[Ge yong]&lt;/p&gt;
&lt;p&gt;&amp;gt; decltype, lambda: doesn't work. I copied the code&lt;/p&gt;
&lt;p&gt;&amp;gt; here &amp;amp; let IDE to compile (not from command line),&lt;/p&gt;
&lt;p&gt;&amp;gt; but failed.&lt;/p&gt;
&lt;p&gt;&amp;quot;doesn't work&amp;quot; and &amp;quot;failed&amp;quot; are not specific enough for my psychic debugging powers. Can you at least show me the compiler errors?&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9635051</link><pubDate>Fri, 22 May 2009 14:25:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9635051</guid><dc:creator>Ge yong</dc:creator><description>&lt;p&gt;I find the reason why it seems to &amp;quot;doesn't work&amp;quot;.&lt;/p&gt;
&lt;p&gt;The code:&lt;/p&gt;
&lt;p&gt;#include &amp;quot;stdafx.h&amp;quot;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;algorithm&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;iostream&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;ostream&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;vector&amp;gt;&lt;/p&gt;
&lt;p&gt;using namespace std;&lt;/p&gt;
&lt;p&gt;int main() {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;int *p= nullptr;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;vector&amp;lt;int&amp;gt; v;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; 10; ++i) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;v.push_back(i);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;for_each(v.begin(), v.end(), [](int n) { cout &amp;lt;&amp;lt; n &amp;lt;&amp;lt; &amp;quot; &amp;quot;; });&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; endl;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;In output window, no problem:&lt;/p&gt;
&lt;p&gt;1&amp;gt;f:\temp\tconsole\tconsole\tconsole.cpp(13): error C2065: 'nullptr' : undeclared identifier&lt;/p&gt;
&lt;p&gt;unfortunately, what I see first is Error List window, the messages in it are confusing:&lt;/p&gt;
&lt;p&gt;Error	1	IntelliSense: identifier &amp;quot;nullptr&amp;quot; is undefined	f:\temp\tconsole\tconsole\tconsole.cpp	13	10	TConsole&lt;/p&gt;
&lt;p&gt;Error	2	IntelliSense: expected an expression	f:\temp\tconsole\tconsole\tconsole.cpp	21	34	TConsole&lt;/p&gt;
&lt;p&gt;Error	3	error C2065: 'nullptr' : undeclared identifier	f:\temp\tconsole\tconsole\tconsole.cpp	13	1	TConsole&lt;/p&gt;
&lt;p&gt;When I clicked on &amp;quot;Error 2&amp;quot;, the character '[' is highlighted on line 21 (the line started with for_each). This make me think &amp;quot;lambda doesn't work&amp;quot;. &lt;/p&gt;
&lt;p&gt;by the way, I see &amp;quot;nullptr&amp;quot; become blue, color of keyword. How to make it work?&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9636151</link><pubDate>Sat, 23 May 2009 01:34:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9636151</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;Thanks for the clarification.&lt;/p&gt;
&lt;p&gt;VC10 Beta 1 doesn't support nullptr, and we currently have no plan to add it to VC10.&lt;/p&gt;
&lt;p&gt;VC10 Beta 1 Intellisense doesn't support the C++0x core language features that the actual compiler supports. This will obviously change.&lt;/p&gt;
&lt;p&gt;It appears that VC10 Beta 1 Intellisense recognizes some C++0x keywords as such, but that doesn't mean that it recognizes the actual features.&lt;/p&gt;
</description></item><item><title>re: decltype: C++0x Features in VC10, Part 3</title><link>http://blogs.msdn.com/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx#9678311</link><pubDate>Mon, 01 Jun 2009 18:22:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9678311</guid><dc:creator>daniel b</dc:creator><description>&lt;p&gt;Thanks for posting these detailed explanations of new X++0x features. &amp;nbsp;Very informative and interesting stuff, even if it sometimes hurts my head a bit!&lt;/p&gt;
&lt;p&gt;Much of the C++0x features (at least what I call the &amp;quot;sexy&amp;quot; features) seem to be similar to those of C# : auto(var), lambdas, initializer lists, enum class, and Range-for. &amp;nbsp;I suppose these types of features are so compelling it's hard to ignore them. &amp;nbsp;This is good news for devs programming with both languages, like myself (practically every time I open VC++ I wish I could use C# foreach, lambdas and enum classes).&lt;/p&gt;
&lt;p&gt;Very exciting stuff!&lt;/p&gt;
</description></item></channel></rss>