Modern Native C++ Development for Maximum Productivity

Play Modern Native C++ Development for Maximum Productivity
Sign in to queue


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!



The Discussion

  • User profile image

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

  • User profile image


    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)>.

    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.

Add Your 2 Cents