Some features of the C++0x standard

April 7th, 2009 by carlos


C++ is growing and changing. As has been the case for the last 20 years, C++ has been developing new features as a response to the changes in computing.
The latest trend of changes in the C++ language is due to the update of the Standard.

A work that has taken many years, the new standard that is by now only known as C++0x (where x will be probably 9) will add many features that will change the way we develop software in C++.

Improved Templates

Templates are the feature in C++ that was used to create reusable containers for any object. Thanks to templates we have now a powerful standard library, with  containers (such as vectors, lists, trees, and strings), and algorithms that operate on these containers.

On the new standard, templates will be improved by providing information on the types that can be used to specialize a template. This is a form of type inference that will make templates much more useful (and with better error codes).

Another nice feature is the addition of auto detection of variable types. Since the type system of C++ is very sophisticated, it makes sense to have a feature in the language to allow types to be automatically detected. The language will use the keyword auto to determine that a variable has the same type as the right hand side on an assignment. So, something as

auto a = new MyObject(); 

is sufficient to create a variable of the type MyObject. Notice that we just need to write MyObject once (while nowadays we needed to repeat the type name before the variable name).

Other Features

The new standard has also several provisions that will improve programming in many ways. Examples include new types of constants, improved initialization of objects, among others. I plan to write about some of these features in the future — stay tuned.

Related Articles

Basecamp