DCSIMG
C++ in Visual Studio 2010: Windows Platform Developers User Group - All Your Base Are Belong To Us

All Your Base Are Belong To Us

Mostly .NET internals and other kinds of gory details

C++ in Visual Studio 2010: Windows Platform Developers User Group

Almost two years ago, I wrote about the TR1, a set of additions to the C++ standard that was implemented in a Feature Pack for Visual Studio 2008. Back then, I gave the post a rather provocative title: C++ Developers Just Got Lambdas?

Well, now we’ve got them. The new C++ standard, dubbed C++0x (where the x is going to be a hexadecimal digit, hopefully A) has lambda functions as one of its features. Visual Studio 2010 implements some of the standard (draft), including lambda functions.

Yesterday I had the pleasure of presenting C++0x to a group of Windows C++ developers, at the Windows Platform Developers User Group organized by Alon Fliess and Pavel Yosifovich. I tried my best to touch all aspects of C++0x, including auto variables, the new “for each” statement, lambda functions, static assertions, the “decltype” operator and a brief mention of rvalue references. [I plan to describe at least some of these features in greater detail in the future.]

Here’s a teaser from the session’s code:

template <typename Iterator, typename Combiner>
auto aggregate(
    Iterator begin,
    Iterator end,
    Combiner comb,
    decltype(comb(*begin,*begin)) initial)
        -> decltype(comb(*begin,*begin))
{
    decltype(comb(*begin,*begin)) result = initial;
    for (; begin != end; ++begin)
    {
        result = comb(result,*begin);
    }
    return result;
}

auto add_f = [](int a,int b) { return a+b; };
list<int> numbers = …;
auto something = aggregate(numbers.begin(),numbers.end(),add_f,0);

Confused? Regardless of whether you attended the session, feel free to download the slides and code. The code is very detailed and shows off some really neat things you can do in C++0x, especially with applications of lambda functions. The language becomes much richer, and naturally much more complicated, but I believe that in the course of the next few years we’re all going to ask ourselves how we managed to write any C++ at all without the features of the new standard.

By the way, if you have ideas for future meetings of the Windows Platform UG, or if you would like to deliver a presentation at the UG, I’m sure Alon and Pavel will be more than happy to hear about it. (You can also contact me if you want to, and I will forward your suggestion to them.)

Comments

Alon Fliess said:

Thanks Sasha for a great lecture!

# January 7, 2010 1:39 PM

C++ in Visual Studio 2010: Windows Platform Developers User Group « Jasper Blog said:

Pingback from  C++ in Visual Studio 2010: Windows Platform Developers User Group &laquo; Jasper Blog

# January 7, 2010 3:26 PM

Jason Haley said:

Interesting Finds: January 8, 2010

# January 8, 2010 2:50 PM

Dew Drop – January 8, 2010 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop &#8211; January 8, 2010 | Alvin Ashcraft&#039;s Morning Dew

# January 8, 2010 3:49 PM

C++ in Visual Studio 2010: Windows Platform Developers User Group « Jasper Blog said:

Pingback from  C++ in Visual Studio 2010: Windows Platform Developers User Group &laquo; Jasper Blog

# January 12, 2010 12:07 PM

Twitter Trackbacks for C++ in Visual Studio 2010: Windows Platform Developers User Group - All Your Base Are Belong To Us [microsoft.co.il] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 C++ in Visual Studio 2010: Windows Platform Developers User Group - All Your Base Are Belong To Us         [microsoft.co.il]        on Topsy.com

# April 16, 2010 6:25 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: