Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Modern Native C++ Development for Maximum Productivity

Download

Right click “Save as…”

Slides (view online)
C++0x, the next C++ standard, is almost upon us and it contains the most important updates to the language since the mid-90s. These new features bring more expressiveness and power to the native C++ developer. Microsoft Visual Studio 2010 has added support for some of these key features in order to enable these modern programming techniques. This session clarifies what features are in Microsoft Visual C++ 2010 and what is yet to come. It illustrates how new constructs such as lambda expressions enable better use of existing libraries and how your code can be simpler, safer and faster all at the same time. Also, see how simple it can be to implement concurrency in your application and how Visual C++ 2010 supports the difficult task of debugging parallelized code. If you are itching to show off how C++ is one of the coolest languages on the planet, this talk is for you!
For more information, check out this course on Microsoft Virtual Academy:

Follow the Discussion

  • FerruccioFerruccio

    The type of prime *is* typeable. It is of type: std::function< bool(int) >

  • MarcMarc

    @Ferruccio

    That's actually not quite right. A Lambda of the form [](int x) { return true; } is _assignable_ to std::function<bool(int)>, but that's not quite the same as saying the type of the lambda _is_ std::function<bool(int)>.

    Consider:
    bool function(int);

    struct functor
    {
    bool operator()(int);
    };

    //...
    std::function<bool(int)> f;

    // I can assign a function pointer to f, is f of type bool (*)(int)?
    f = &function;

    // I can assign a functor to f, is f of type functor?
    f = functor();

    // And now a lambda
    f = [](int x){ return false; };

    In the above example, f is none of a function pointer, a function object, or a lambda, yet it accepts all of them just fine.

    Lastly, consider:

    decltype([](int x) { return false; }) x = [](int x){ return false; };

    In the above, I am trying really really hard to get the correct type of the lambda so I can name the type explicitly, yet (in VS2010 anyway) that won't compile. So, it seems that indeed, the type of a lambda is untypable, even though that doesn't stop us from assigning it to std::function or doing other useful things with it.

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.