Jump to content

A good overview of some of the new features in C++11.


Valik
 Share

Recommended Posts

Article here.

Lots of great stuff here.

  • Lambda expressions. I use them in languages that support them and now C++ does.
  • The multi-threading library. What more can I say. Native C++ multi-threading. This should simplify code a bit since it will no longer require trying to tie in C++ objects with a C threading API.
  • Improvements to initialization, particularly member initialization.
  • Delegate constructors. Very cool. This avoids having to write a private member to perform the construction and then call that member from each constructor. Now we can just write one real constructor and the alternatives can delegate to the real one.
  • The new default and delete keywords seem interesting, especially delete. Hopefully the delete keyword will lead to better compiler errors for non-copyable objects. It's also trivial to modify existing NoCopy classes to use the new keyword instead of the old private method.
  • Rvalue references and move semantics may be useful, particularly for string classes.
The only thing I'm not sure about is the auto keyword. In theory automatic type deduction seems really cool. However, I worry that it may unintentionally obfuscate code since the type declaration is no longer visible to the programmer. I can see some uses for it as templates can be unwieldy (Here's looking at you iterators), but still, I prefer verbosity in almost all cases. We'll see how this one works out.
Link to comment
Share on other sites

I'm not sure about is the auto keyword. In theory automatic type deduction seems really cool. However, I worry that it may unintentionally obfuscate code since the type declaration is no longer visible to the programmer. I can see some uses for it as templates can be unwieldy (Here's looking at you iterators), but still, I prefer verbosity in almost all cases. We'll see how this one works out.

C# has had var keyword for a while now, and I can definitely tell you it has lead to more readable and maintainable code overall. There are plenty of advantages to think of, and just like any other feature: programmers need to learn when to use it and when not to use it. : )
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...