- C++0x
C++0x is the planned new standard for the C++ programming language. It is intended to replace the existing C++ standard,
ISO/IEC 14882 , which was published in 1998 and updated in 2003. These predecessors are informally known as C++98 and C++03. The new standard will include several additions to thecore language and will extend theC++ standard library , incorporating most of the C++Technical Report 1 libraries — most likely with the exception of the library of mathematical special functions. Since the standard is not yet finalized, this article may not reflect the most recent state of C++0x. Up-to-date state of the next C++ standard is published on [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/ the ISO C++ committee website] . The most recent report, [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2705.html N2705] , was published in July 2008.The
ISO /IEC JTC1/SC22/WG21 C++ Standards Committee aims to introduce the new standard in 2009 (hence the standard that is today called C++0x will become C++09) which means that the document must be ready for ratification of the member states of ISO in 2008. To be able to finish on schedule, the Committee decided to focus its efforts on the solutions introduced up until 2006 and ignore newer proposals ref label|strousup-brieflook|1|a.Programming language s such as C++ use an evolutionary process to develop their definition. This process inevitably raises compatibility issues with existing code, which has happened occasionally during the C++ development process. However, according to the announcement made byBjarne Stroustrup (inventor of the C++ language and member of the committee), the new standard will be almost 100% compatible with the current standard ref label|strousup-designof|2|a.Candidate changes for the impending standard update
The modifications for C++ will involve both the core language and the standard library.
In the development of every utility of the new standard, the committee has applied some directives:
*Maintain stability and compatibility with C++98 and possibly with C;
*Prefer introduction of new features through the standard library, rather than extending the core language;
*Prefer changes that can evolve the programming technique;
*Improve C++ to facilitate systems and library design, rather than to introduce new features only useful to specific applications;
*Increase type safety by providing safer alternatives to current, unsafe techniques;
*Increase performance and the ability to work directly with hardware;
*Provide proper solutions for real world problems;
*Implement “zero-overhead” principle (additional support required by some utilities must be used only if the utility is used);
*Make C++ easy to teach and to learn without removing any utility needed by expert programmers.Attention to beginners is important, because they will always comprise the majority of computer programmers, and because many beginners do not intend to extend their knowledge of nowrap|C++, limiting themselves to operate in the fields in which they are specialized ref label|strousup-brieflook|1|b. Additionally, considering the vastness of C++ and its usage (including areas of application and programming styles), even the most experienced programmers can become beginners in a new
programming paradigm .Extensions to the C++ core language
The main focus of the C++ committee is the development of the language core. The presentation date of C++0x depends on the progress of this part of the standard.
Areas of the core language that will be significantly improved include
multithreading support,generic programming support, uniform initialization, and performance enhancements.For the purposes of this page, core language features and changes are grouped into 4 general sections: runtime performance enhancements, build time performance enhancements, usability enhancements, or new functionality. Some features could fall into multiple groups, but they will only be mentioned in the one that feature primarily represents.
Core language runtime performance enhancements
These language features primarily exist to provide some kind of performance benefit. This can be memory or speed.
Rvalue reference and move semantics
In standard C++, temporaries (termed "R-values", as they lie on the right side of an assignment) can be passed to functions, but they can only be accepted as const & types. As such, it is impossible for a function to distinguish between an actual R-value and a regular object that is passed as const &. Furthermore, since the type is const &, it is not possible to actually change the object.
C++0x will add a new reference type called an R-value reference. It is defined as typename &&. These can be accepted as non-const values, which allows an object to modify them. This modification allows for certain objects to create move semantics.
For example, a std::vector is, internally, a wrapper around a C-style array with a size. If a vector temporary is created or returned from a function, it can only be stored by creating a new vector and having it copy all of the R-value's data into it. Then the temporary is destroyed, deleting its data.
With R-value references, a "move constructor" of std::vector that takes an R-value reference to a vector can simply copy the pointer to the internal C-style array out of the R-value into the new vector, then leave the R-value in an empty state. There is no array copying, and the destruction of the empty temporary does not destroy the memory. The function returning a vector temporary need only return a std::vector<>&&. If vector has no move constructor, then the copy constructor will be invoked with a const std::vector<> & as normal. If it does have a move constructor, then the move constructor can be invoked, and significant memory allocation can be avoided.
For safety reasons a named variable will never be considered to be an R-value even if it's declared as such, in order to get an R-value the library function std::move() should be used.
Due to the nature of the wording of R-value references, and to some modification to the wording for L-value references (regular references), R-value references allow developers to provide perfect function forwarding. When combined with
variadic templates, this ability allows for function templates that can perfectly forward arguments to another function that takes those particular arguments. This is most useful for forwarding constructor parameters, to create factory functions that will automatically call the correct constructor for those particular arguments.Generalized constant expressions
C++ has always had the concept of constant expressions. These are expressions such as 3+4 that will always yield the same results and that have no side effects. Constant expressions are optimization opportunities for compilers, and compilers frequently execute them at compile time and store the results in the program. Also, there are a number of places where the C++ specification requires the use of constant expressions. Defining an array requires a constant expression, and enumerator values must be constant expressions.
However, constant expressions have always ended whenever a function call or object constructor was encountered. So something as simple as this is illegal:
This is not legal C++, because GetFive() + 5 is not a constant expression. The compiler has no way of knowing if GetFive actually is constant at runtime. In theory, this function could affect a global variable, call other non-runtime constant functions, etc.
C++0x will introduce the keyword constexpr, which allows the user to guarantee that a function or object constructor is a compile-time constant. The above example can be rewritten as follows:
This allows the compiler to understand, and verify, that GetFive is a compile-time constant.
The use of constexpr on a function imposes very strict limitations on what that function can do. First, the function must have a non-void type. Second, the function contents must be of the form, "return "expr". Third, expr must be a constant expression, after argument substitution. This constant expression may only call other functions defined as constexpr, or it may use other constant expression data variables. Fourth, all forms of recursion in constant expressions are forbidden. Lastly, a function with this label cannot be called until it is defined in this translation unit.
Variables can also be defined as constant expression values:
Constant expression data variables are implicitly const. They can only store the results of constant expressions or constant expression constructors.
In order to construct constant expression data values from user-defined types, constructors can also be declared with constexpr. A constant expression constructor must be defined before its use in the translation unit, as with constant expression functions. It must have an empty function body. It must initialize its members with constant expressions. And the destructors for such types should be trivial.
Copying constexpr constructed types should also be defined as a constexpr, in order to allow them to be returned by value from a constexpr function. Any member function of a class, such as copy constructors, operator overloads, etc, can be declared as constexpr, so long as they fit the definition for function constant expressions. This allows the compiler to copy classes at compile time, perform operations on them, etc.
A constant expression function or constructor can be called with non-constexpr parameters. Just as a constexpr integer literal can be assigned to a non-constexpr variable, so too can a constexpr function be called with non-constexpr parameters, and the results stored in non-constexpr variables. The keyword only allows for the possibility of compile-time constancy when all members of an expression are constexpr.
Modification to the definition of plain old data
In standard C++, a struct must follow a number of rules in order for it to be considered a plain old data (POD) type. There are good reasons for wanting a larger number of types to fit this definition. Types that fit this definition allow implementations to produce object layouts that are compatible with C. However, the list of rules in C++03 is overly strict.
C++0x will relax several rules with regard to the POD definition.
A class/struct is considered a POD if it is "trivial", "standard-layout", and if all of its non-static members are PODs. A trivial class or struct is defined as one that:
# Has a trivial default constructor. This may use the default constructor syntax (SomeConstructor() = default;).
# Has a trivial copy constructor, which may use the default syntax.
# Has a trivial copy assignment operator, which may use the default syntax.
# Has a trivial destructor, which may not be virtual.A standard-layout class or struct is defined as one that:
# Has only non-static data members that are of standard-layout type
# Has the same access control (public, private, protected) for all non-static members
# Has no virtual functions
# Has no virtual base classes
# Has only base classes that are of standard-layout type
# Has no base classes of the same type as the first defined non-static member
# Either has no base classes with non-static members, or has no non-static data members in the most derived class and at most one base class with non-static members. In essence, there may be only one class in this class's hierarchy that has non-static members.Core language build time performance enhancements
Extern template
In standard C++, the compiler must instantiate a template whenever a fully specified template is encountered in a translation unit. This can dramatically increase compile time, particularly if the template is instantiated in many translation units using the same parameters. There is no way to tell C++ not to provoke an instantiation of a template.
C++0x will introduce the idea of external templates. C++ already has syntax for forcing the compiler to instantiate at a particular location:
What C++ lacks is the ability to prevent the compiler from instantiating a template in a translation unit. C++0x will simply extend this syntax to:
This tells the compiler "not" to instantiate the template in this translation unit.
Core language usability enhancements
These features exist for the primary purpose of making the language easier to use. These can improve type safety, minimize code repetition, make it more difficult to erroneously use code, or something similar.
Initializer lists
Standard C++ borrows the initializer list concept from C. The idea is that a struct or array can be created giving a list of arguments in the order of the members' definitions in the struct. These initializer lists are recursive, so an array of structs or struct containing other structs can use them. This is very useful for static lists or just for initializing a struct to a particular value. C++ has constructors, which can replicate the initialization of an object. But that alone does not replace all of the utility of this feature. Standard C++ allows this on structs and classes, except that these objects must conform to the Plain Old Data (POD) definition; non-POD classes cannot use initializer lists, nor can useful C++-style containers like std::vector and boost::array.
C++0x will bind the concept of initializer lists to a type, called std::initializer_list. This allows constructors and other functions to take initializer lists as parameters. For example:
This will allow SequenceClass to be constructed from a sequence of integers, as such:
This constructor is a special kind of constructor, called an initializer list constructor. Classes with such a constructor are treated specially during uniform initialization.
The class std::initializer_list<> is a first-class C++0x standard library type. However, they can only be initially constructed statically by the C++0x compiler through the use of the {} syntax. The list can be copied once constructed, though this is only a copy-by-reference. An initializer list is constant; its members cannot be changed once the initializer list is created, nor can the data in those members be changed.
Because initializer_list is a real type, it can be used in other places besides class constructors. Regular functions can take typed initializer lists as arguments. For example:
Standard containers can also be initialized this way:
Uniform initialization
Standard C++ has a number of problems with initializing types. There are several ways to initialize types, and they do not all produce the same results when interchanged. The traditional constructor syntax, for example, can look like a function declaration, and steps have to be taken to ensure that the compiler will not mistake it for such. Only aggregates and POD types can be initialized with aggregate initializers (using
SomeType var = {/*stuff*/};
).C++0x will provide a syntax that allows for fully uniform type initialization that will work on any object. It expands on the initializer list syntax:
The initialization of var1 functions exactly as though it were a C-style initializer list. Each public variable will be initialized with each value of the initializer list. Implicit type conversion will be used where necessary, and if there is no type conversion available, then the compiler will fail to compile.
The initialization of var2 simply calls the constructor.
The uniform initialization construct can remove the need for specifying certain types:
This syntax will automatically initialize the std::string with the const char * parameter. One is also able to do the following:
Uniform initialization will not replace constructor syntax. There will still be times when constructor syntax will be required. If a class has an initializer list constructor (TypeName(initializer_list
); ), then it takes priority over other forms of construction, if the initializer list conforms to the sequence constructor's type. The C++0x version of std::vector will have an initializer list constructor for its template type. This means that:This will call the initializer list constructor, not the constructor of std::vector that takes a single size parameter and creates the vector with that size. To access this constructor, the user will need to use the standard constructor syntax directly.
Type determination
In standard C++ (and C), the type of a variable must be explicitly specified in order to use it. However, with the advent of template types and template metaprogramming techniques, the type of something, particularly the well-defined return value of a function, may not be easily expressed. As such, storing intermediates in variables is difficult, possibly requiring knowledge of the internals of a particular metaprogramming library.
C++0x allows this to be mitigated in two ways. First, the definition of a variable with an explicit initialization can use the auto keyword. This creates a variable of the specific type of the initializer:
The type of someStrangeCallableType is simply whatever the particular template function override of
boost::bind
returns for those particular arguments. This is easily known to the compiler, but is not easy for the user to determine upon inspection.The type of otherVariable is also well-defined, but it is easier for the user to determine. It is an int, which is the same type as the integer literal.
Additionally, the keyword, decltype can be used to compile-time determine the type of an expression. For example:
This is more useful in conjunction with auto, since the type of auto variable is known only to the compiler. However, decltype can also be very useful for expressions in code that makes heavy use of operator overloading and specialized types.
auto
is also useful for reducing the verbosity of the code. For instance, instead of writingthe programmer can use the shorterThis difference grows as the programmer begins to nest containers, though in such casestypedef
s are a good way to decrease the amount of code.Range-based for-loop
The Boost C++ library defines a number of "Range" concepts. Ranges represent a controlled list, much like a container, between two points in that list. Ordered containers are a superset of the range concept, and two iterators in an ordered container can define a range as well. These concepts, and algorithms that operate on them, will be incorporated into C++0x's standard library. However, the utility of range concepts is such that C++0x will provide a language feature built around them.
The statement for will allow for easy iteration over a range concept:
The first section of the new for loop defines the variable that will be used to iterate over the range. The variable, as with variables declared in the regular for-loop, only has scope for the duration of the loop. The second section, after the ":", represents the range concept being iterated over. In this case, there is a concept map that allows C-style arrays to be converted into range concepts. This could have been a std::vector, or any object that conforms to a range concept.
Lambda functions and expressions
In standard C++, particularly in conjunction with C++ standard library algorithm functions such as sort and find, the user will often wish to define predicate functions near the invocation of the algorithm function call. The language has only one mechanism for this: the ability to define a class inside of a function. This is often cumbersome and verbose, as well as interrupting the flow of the code. Additionally, standard C++'s rules for classes defined in functions do not permit them to be used in templates, so using them is simply not possible.
The obvious solution would be to allow for the definition of lambda expressions and lambda functions. C++0x will allow for the definition of lambda functions.
A lambda function is defined as follows:
The return type of this unnamed function is decltype(x+y). The return type can only be omitted if the lambda function is of the form "return "expression". This limits the lambda function to one statement.
The return type can be explicitly specified as follows, for a more complicated example:
In this example, a temporary variable, z is created to store an intermediate. As with normal functions, the value of this intermediate is not held between invocations.
The return type can be omitted entirely if the lambda function does not return a value (i.e. if the return type is void).
References to variables defined in the same scope as the lambda function can be used as well. The set of variables of this sort is commonly called a closure. Closures are defined and used as follows:
This would display the total of all elements in the list.The variable total is stored as a part of the lambda function's closure. Since it is a reference to the stack variable total, it can change its value.
Closure variables for stack variables can also be defined without the reference symbol "&", which indicates that the lambda function will copy the value. This forces the user to declare their intent to reference stack variables or copy them. The referencing of stack variables can be dangerous. If a lambda function will be used outside the scope of its creation, by storing it in a std::function object (standard in C++0x) for example, then the user must make certain that no stack variables are referenced by the lambda function.
For lambda functions that are guaranteed to run in the scope of its definition, it is possible to use all available stack variables without having to explicitly reference them:
The specific internal implementation can vary, but the expectation is that the lambda function will store the actual stack pointer of the function it is created in, rather than individual references to stack variables.
If [=] is used instead of [&] , all referenced variables will be copied, allowing the lambda function to be used after the end of the lifetime of the original variables.
The defaults can also be combined with lists. For example, if the user wants to capture most variables by reference, but have one by value, then the user can do the following:
This will cause total to be stored as a reference, but value will be stored as a copy.
If a lambda function is defined by a member function of a class, it is assumed to be a friend of that class. Such lambda functions can use a reference to an object of the class type and access its internal members:
This will only work if the scope of this lambda function's creation is in a member function of SomeType.
The handling of the this pointer, referencing the object that the current member function is operating on, is special. It must be explicitly designated in the lambda function:
Using the [&] or [=] form of lambda functions will automatically make this available.
Lambda functions are function objects of a compiler-dependent type; this type's name is only available to the compiler. If the user wishes to take a lambda function as a parameter, the type must be a template type, or it must create a std::function to capture the lambda value. The use of the auto keyword can locally store the lambda function:
However, if the lambda function captures all of its closure variables by reference, or if it has no closure variables, then the generated function object is given a special type: std::reference_closure
, where R(P) is the function signature with return type. This is expected to be a more efficient representation for lambda functions than capturing them in a std::function: Unified function syntax
Standard C function declaration syntax was perfectly adequate for the feature set of the C language. As C++ evolved from C, it kept the basic syntax and extended it where necessary. However, as C++ became more complicated, it exposed a number of limitations, particularly with regard to template function declarations. The following, for example, is not allowable in C++03:
The type Ret is whatever the addition of types LHS and RHS will produce. Even with the aforementioned C++0x functionality of decltype, this is not possible:
This is not legal C++ because lhs and rhs have not yet been defined; they will not be valid identifiers until after the parser has parsed the rest of the function prototype.
To work around this, C++0x will introduce a new function definition and declaration syntax:
This syntax can be used for more mundane function declarations and definitions:
The use of the [] syntax is exactly as for lambda functions. If there is no function name, then it is a lambda expression (except that lambda functions cannot be templates, so the AddingFunc example could not be a lambda). Since functions can be defined at block scope, it is possible to create a named lambda function:
These are equivalent statements, both producing variables of type std::reference_closure
. However, the following two statements are not equivalent:
The variable NamedLambda1 is a regular C-style function pointer, just as if it had been defined as int NamedLambda1(int a). The variable NamedLambda2 is defined to be of type std::reference_closure
. The first line shows the new form for nested functions with C++0x. Concepts
In C++, template classes and functions necessarily impose restrictions on the types that they take. For instance, the STL containers require that the contained types be assignable. Unlike the dynamic polymorphism that class inheritance hierarchies exhibit, where a function that accepts an object of type
Foo&
can be passed any subtype ofFoo
, any class can be supplied as a template parameter so long as it supports all of the operations that the template uses. In the case of the function the requirement an argument must meet is clear (being a subtype ofFoo
), but in the case of a template the interface an object must meet is implicit in the implementation of that template. Concepts provide a mechanism for codifying the interface that a template parameter must meet.The primary motivation of the introduction of concepts is to improve the quality of compiler error messages. If a programmer attempts to use a type that does not provide the interface a template requires, the compiler will generate an error. However, such errors are often difficult to understand, especially for novices. There are two main reasons for this. First, error messages are often displayed with template parameters spelled out in full; this leads to extremely large error messages. On some compilers, simple errors can generate several kilobytes of error messages. Second, they often do not immediately refer to the actual location of the error. For example, if the programmer tries to construct a
vector
of objects that do not have a copy constructor, the first error almost always refers to the code within thevector
class itself that attempts to copy construct its contents; the programmer must be skilled enough to understand that the real error was that the type doesn't support everything thevector
class requires.In an attempt to resolve this issue, C++0x adds the language feature of "concepts". Similar to how OOP uses a base-class to define restrictions on what a type can do, a concept is a named construct that specifies what a type must provide. Unlike OOP, however, the concept definition itself is not always associated explicitly with the type being passed into the template, but with the template definition itself:
Rather than using an arbitrary
class
ortypename
for the template type parameter, it usesLessThanComparable
, which is a concept that was previously defined. If a type passed into themin
template function does not satisfy the requirements of theLessThanComparable
concept, then a compile error will result, telling the user that the type used to instantiate the template does not fit theLessThanComparable
concept.A more generalized form of the concept is as follows:
The keyword
requires
begins a list of concept declarations. It can also be used for concepts that use multiple types. Additionally, it can be used asrequires !LessThanComparable
, if the user wishes to prevent the use of this particular template if the type matches the concept. This mechanism can be used in a way similar to template specialization. A general template would handle types with fewer features, explicitly disallowing the use of other, more feature-rich, concepts. And those concepts would have their own specializations that use those particular features to achieve greater performance or some other functionality.Concepts are defined as follows:
The keyword
auto
, in this instance, means that any type that supports the operations specified in the concept will be considered to support the concept. Without the use of theauto
keyword, then the type must use a concept map in order to declare itself as supporting the concept.This concept says that any type that has an
operator <
that takes two objects of that type and returns abool
will be consideredLessThanComparable
. The operator need not be a free-function; it could be a member function of the typeT
.Concepts can involve multiple objects as well. For example, concepts can express that a type is convertible from one type to another:
In order to use this in a template, it must use a generalized form of concept usage:
Concepts may be composed. For example, given a concept named
Regular
:The first template parameter to the
InputIterator
concept must conform to theRegular
concept.Concepts can also be derived from one another, like inheritance. Like in class inheritance, types that meet the requirements of the derived concept also meet the requirements of the base concept. It is defined as per class derivation:
Typenames can also be associated with a concept. These impose the requirement that, in templates that use those concepts, these typenames are available:
Concept maps allow types to be explicitly bound to a concept. They also allow types to, where possible, adopt the syntax of a concept without changing the definition of the type. As an example:
This map fills in the required typenames for the
InputIterator
concept when applied tochar*
types.As an added degree of flexibility, concept maps themselves can be templated. The above example can be extended to all pointer types:
Further, concept maps can act as mini-types, with function definitions and other constructs commonly associated with classes:
This concept map allows templates that take types that implement the concept
Stack
to take astd::vector
, remapping the function calls directly to thestd::vector
calls. Ultimately, this allows a pre-existing object to be converted, without touching the definition of the object, into an interface that a template function can utilize.Finally, it should be noted that some requirements can be checked using static assertions. These can verify some requirements that templates need, but are really aimed at a different problem.
Object construction improvement
In standard C++, constructors are not allowed to call other constructors; each constructor must construct all of its class members itself or call a common member function. Constructors for base classes cannot be directly exposed to derived classes; each derived class must implement constructors even if a base class constructor would be appropriate. Non-constant data members of classes cannot be initialized at the site of the declaration of those members. They can only be initialized in a constructor.
C++0x will provide solutions to all of these problems.
C++0x will allow constructors to call other peer constructors (known as delegation). This will allow constructors to utilize another constructor's behavior with a minimum of added code. Other languages, such as Java and C#, provide this.
This syntax is as follows:
Notice that the same effect could have been achieved by making newNumber a defaulting parameter.
This comes with a caveat: C++03 considers an object to be constructed when its constructor finishes executing, but C++0x will consider an object constructed once "any" constructor finishes execution. Since multiple constructors will be allowed to execute, this will mean that each delegate constructor will be executing on a fully-constructed object of its own type. Derived class constructors will execute after all delegation in their base classes is complete.
For base-class constructors, C++0x will allow a class to specify that base class constructors will be inherited. This means that the C++0x compiler will generate code to perform the inheritance, the forwarding of the derived class to the base class. Note that this is an all-or-nothing feature; either all of that base class's constructors are forwarded or none of them are. Also, note that there are restrictions for multiple inheritance, such that class constructors cannot be inherited from two classes that use constructors with the same signature. Nor can a constructor in the derived class exist that matches a signature in the inherited base class.
The syntax will be as follows:
For member initialization, C++0x will allow the following syntax:
Any constructor of the class will initialize iValue with 5, if the constructor does not override the initialization with its own. So the above empty constructor will initialize iValue as the class definition states, but the constructor that takes an int will initialize it to the given parameter.
Null pointer
Since the dawn of C in 1972, the constant 0 has the double role of constant integer and null pointer. The ambiguity inherent in the double meaning of 0 was dealt with in C by the use of the preprocessor macro
NULL
, which expands to either((void*)0)
or0
. When C++ adopted this behavior, additional ambiguities were created due to other design decisions in C++. Implicit conversion from typevoid*
to other pointer types is not permitted, soNULL
must be defined as0
in order for statements likechar* c = NULL;
to compile. This interacts poorly with function overloading:The statement
foo(NULL);
will callfoo(int)
, which is almost certainly not what the programmer intended.C++0x aims to correct this by introducing an explicit null pointer new keyword:
nullptr
.nullptr
is of a type that is implicitly convertible and comparable to any pointer type or pointer-to-member type. It is not implicitly convertible or comparable to integer types.The existing role of 0 will remain for backwards compatibility reasons. If the new syntax is a success, the C++ committee could declare deprecated the usage of
0
andNULL
as null pointers, and eventually abolish this double role.
trongly typed enumerations
In standard C++, enumerations are not type-safe. They are effectively integers, even when the enumeration types are distinct. This allows the comparison between two enum values of different enumeration types. The only safety that C++03 provides is that an integer or a value of one enum type does not convert implicitly to another enum type. Additionally, the underlying integral type, the size of the integer, cannot be explicitly specified; it is implementation defined. Lastly, enumeration values are scoped to the enclosing scope. As such, it is not possible for two separate enumerations to have matching member names.
C++0x will allow a special classification of enumeration that has none of these issues. This is expressed using the enum class declaration:
This enumeration is type-safe. Enum class values are not implicitly converted to integers; as such, they cannot be compared to integers either (Enumeration::Val4 = 101 gives a compiler error).
The underlying type of enum classes is explicitly specified. The default, as in the above case, is int, but it can be changed as follows:
The scoping of the enumeration is also defined as the enumeration name's scope. Using the enumerator names requires explicitly scoping. Val1 is undefined, but Enum2::Val1 is defined.
Additionally, C++0x will allow standard enumerations to provide explicit scoping as well as the definition of the underlying type:
The enumerator names are defined in the enumeration's scope (Enum3::Val1), but for backwards compatibility, enumerator names are also placed in the enclosing scope.
Forward declaration of enums is also possible in C++0x. Previously, the reason enum types could not be forward declared is because the size of the enumeration depends on its contents. As long as the size of the enumeration is specified by the application, it can be forward declared:
Angle bracket
Standard C++'s parser defines ">>" as the right shift operator, in all cases. However, in template definitions, this is almost always the wrong way to interpret two right angle brackets.
C++0x will improve the specification of the parser so that multiple right angle brackets will be interpreted as closing the template argument list where it is reasonable. This can be overridden by using parenthesis:
Explicit conversion operators
Standard C++ added the explicit keyword as a modifier on constructors to prevent single-argument constructors to be used as implicit type conversion operators. However, this does nothing for actual conversion operators. For example, a smart pointer class may have an operator bool() to allow it to act more like a primitive pointer: if it includes this conversion, it can be tested with if(smart_ptr_variable) (which would be true if the pointer was non-null and false otherwise). However, this allows other, unintended conversions as well. Because C++ bool is defined as an arithmetic type, it can be implicitly converted to integral or even floating-point types, which allows for mathematical operations that are not intended by the user.
In C++0x, the explicit keyword can now be applied to conversion operators. As with constructors, they prevent further implicit conversion.
Template typedefs
In standard C++, it is only possible to define a template typedef if all of the template parameters are defined. It is not possible to create a typedef with undefined template parameters. For example:
This will not compile.
C++0x will add this ability with the following syntax:
Transparent garbage collection
C++0x will not feature transparent garbage collection directly. Instead, the C++0x standard will include features that will make it easier to implement garbage collection in C++.
Full garbage collection support has been remanded to a later version of the standard or a Technical Report.
Unrestricted unions
In Standard C++ there are restrictions on what type of objects can be members of a union. For example, unions cannot contain any objects which define a non-trivial constructor. Many of the limitations imposed on unions seem unnecessary, so in the next standard all restrictions on the types of members of unions will be removed, with the exception of reference types. These changes will make unions easier to use, more powerful, and much more useful. [ [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf N2544] ]
This is a simple example of a union permitted in C++0x:
The changes will not break any existing code since they only involve relaxing current rules.
Core language functionality improvements
These features allow the language to do things in the language which were previously impossible, exceedingly verbose, or required non-portable libraries.
Variadic templates
Standard C++ templates (classes and functions) can only take a set sequence of arguments. C++0x will allow template definitions to take an arbitrary number of arguments of any type.
This template class "tuple" will take any number of typenames as its template parameters:
The number of arguments can be 0, so "class tuple<> someInstanceName" will work as well.
If one does not want to have a variadic template that takes 0 arguments, then this definition will work as well:
Variadic templates may also apply to functions, thus providing a type-safe mechanism similar to the standard C variadic function mechanism:
Note the use of the "..." operator on the right of the type "Params" in the function signature, rather than the left as in the template specification. When the "..." operator is on the left of the type, as in the template specification, it is the "pack" operator. This signifies that the type can be zero or more of them. When the operator is to the right of the type, it is the "unpack" operator. This causes the replication of the operations done on that type, one for each of the types that were packed with the pack operator. In the above example, the function printf will be given a parameter for each of the types packed in Params.
The use of variadic templates is often recursive. The variadic parameters themselves are not readily available to the implementation of a function or class. As such, the typical mechanism for defining something like a C++0x variadic "printf" replacement would be as follows:
This is a recursive call. Notice that the variadic template version of "printf" calls itself, or in the event that "args" is empty, calls the simple case.
There is no simple mechanism to iterate over the values of the variadic template. However, using the unpack operator, the template arguments can be unpacked virtually anywhere.
For example, a class can specify the following:
The unpack operator will replicate the types for the base classes of ClassName, such that this class will be derived from each of the types passed in. Also, the constructor must take a reference to each base class, so as to initialize the base classes of ClassName.
With regard to function templates, the variadic parameters can be forwarded. When combined with r-value references (see below), this allows for perfect forwarding:
This unpacks the argument list into the constructor of TypeToConstruct. The std::forward
(params) syntax is the syntax that perfectly forwards arguments as their proper types, even with regard to rvalue-ness, to the constructor. The unpack operator will propagate the forwarding syntax to each parameter. This particular factory function automatically wraps the allocated memory in a tr1::shared_ptr for a degree of safety with regard to memory leaks.Additionally, the number of arguments in a template parameter pack can be determined as follows:
The syntax SomeStruct
::size will be 2, while SomeStruct<>::size will be 0.New string literals
Standard C++ offers two kinds of string literals. The first kind, contained within double quotes, produces a null-terminated array of type const char. The second kind, defined as, L"", produces a null-terminated array of type const wchar_t, where wchar_t is a wide-character. Neither literal type offers support for
Unicode -encoded string literals.For the purpose of enhancing support for Unicode in C++ compilers, the definition of the type char has been modified to be both at least the size necessary to store an eight-bit coding of
UTF-8 and large enough to contain any member of the compiler's basic execution character set. It was previously defined as only the latter.There are three Unicode encodings that C++0x will support:
UTF-8 ,UTF-16 , andUTF-32 . In addition to the previously noted changes to the definition of char, C++0x will add two new character types: char16_t and char32_t. Each of these is designed to store UTF-16 and UTF-32 respectively.The following shows how to create string literals for each of these encodings:
The type of the first string is the usual
const char []
. The type of the second string isconst char16_t []
. The type of the third string isconst char32_t []
.When building Unicode string literals, it is often useful to insert Unicode codepoints directly into the string. To do this, C++0x will allow the following syntax:
The number after the 'u' is a hexadecimal number; it does not need the usual '0x' prefix. The identifier 'u' represents a 16-bit Unicode codepoint; to enter a 32-bit codepoint, use 'U' and a 32-bit hexadecimal number. Only valid Unicode codepoints can be entered. For example, codepoints on the range U+D800—U+DFFF are forbidden, as they are reserved for surrogate pairs in UTF-16 encodings.
It is also sometimes useful to avoid escaping strings manually, particularly for using literals of
XML files or scripting languages. C++0x will provide a raw string literal:R" [The String Data Stuff " ] "R"delimiter [The String Data Stuff " ] delimiter"In the first case, everything between the
[
]
brackets is part of the string. The"
andcharacters do not need to be escaped. In the second case, the
"delimiter [
starts the string, and it only ends when] delimiter"
is reached. The stringdelimiter
can be any arbitrary string, which allows the user to use]
characters within raw string literals.Raw string literals can be combined with the wide literal or any of the Unicode literals:
User-defined literals
Standard C++ provides a number of literals. The characters, "12.5" are a literal that is resolved by the compiler as a type double with the value of 12.5. However, the addition of the suffix "f", as in "12.5f", creates a value of type float that contains the value 12.5. The suffix modifiers for literals is fixed by the C++ specification, and C++ code cannot create new literal modifiers.
C++0x will also include the ability for the user to define new kinds of literal modifiers that will construct objects based on the string of characters that the literal modifies.
Literals transformation is redefined into two distinct phases: raw and cooked. A raw literal is a sequence of characters of some specific type, while the cooked literal is of a separate type. The C++ literal 1234, as a raw literal, is this sequence of characters '1', '2', '3', '4'. As a cooked literal, it is the integer 1234. The C++ literal 0xA in raw form is '0', 'x', 'A', while in cooked form it is the integer 10.
Literals can be extended in both raw and cooked forms, with the exception of string literals, which can only be processed in cooked form. This exception is due to the fact that strings have prefixes that affect the specific meaning and type of the characters in question.
All user-defined literals are suffixes; defining prefix literals is not possible.
User-defined literals processing the raw form of the literal are defined as follows:
The second statement executes the code defined by the user-defined literal function. This function is passed "1234" as a C-style string, so it has a null terminator.
An alternative mechanism for processing raw literals is through a variadic template:
This instantiates the literal processing function as operator"Suffix"<'1', '2', '3', '4'>. In this form, there is no terminating null character to the string. The main purpose to doing this is to use C++0x's constexpr keyword and the compiler to allow the literal to be transformed entirely at compile time, assuming OutputType is a constexpr-constructable and copyable type, and the literal processing function is a constexpr function.
For cooked literals, the type of the cooked literal is used, and there is no alternative template form:
For string literals, the following are used, in accordance with the previously mentioned new string prefixes:
Character literals are defined similarly.
Multitasking memory model
The C++ standard committee plans to standardise support for multithreaded programming.
There are two parts involved: defining a memory model which will allow multiple threads to co-exist in a program, and defining support for interaction between threads. The second part will be provided via library facilities, see threading facilities.
A memory model is necessary in order to dictate under which circumstances multiple threads may access the same memory location. A program which adheres to the rules is guaranteed to execute correctly, but a program which breaks the rules may have unexpected behavior due to
compiler optimization s and problems withmemory coherence .Thread-local storage
In a multi-threaded environment, every thread must often have unique
variables . This already happens for the local variables of a function, but it does not happen for global and static variables.A new "thread-local" storage duration (in addition to the existing "static", "dynamic" and "automatic") has been proposed for the next standard. Thread local storage will be indicated by the storage specifier
thread_local
.Any object which could have static storage duration (i.e. lifetime spanning the entire execution of the program) may be given thread-local duration instead. The intent is that like any other static-duration variable, a thread-local object can be initialized using a constructor and destroyed using a destructor.
Defaulting/deleting of standard functions on C++ objects
In standard C++, the compiler will provide, for objects that do not provide for themselves, a default constructor, a copy constructor, a copy assignment operator operator=, and a destructor. As mentioned, the user can override these defaults by defining their own version. C++ also defines several global operators (such as operator=, and operator new) that work on all classes, which the user can override.
The problem is that there are very few controls over the creation of these defaults. Making a class inherently non-copyable, for example, requires declaring a private copy constructor and copy assignment operator and not defining them. Attempting to use these functions will cause a compiler or linker error. However, this is not an ideal solution.
Further, in the case of the default constructor, it is useful to want to explicitly tell the compiler to generate it. The compiler will not generate a default constructor if the object is defined with "any" constructors. This is useful in many cases, but it is also useful to be able to have both a specialized constructor and the compiler-generated default.
C++0x will allow the explicit use, or disuse, of these standard object functions. For example, the following type explicitly declares that it is using the default constructor:
Alternatively, certain features can be explicitly disabled. For example, the following type is non-copyable:
A type can be made impossible to allocate with operator new:
This object can only ever be allocated as a stack object or as a member of another type. It cannot be directly heap allocated without non-portable trickery. (Since placement new is the only way to call a constructor on user-allocated memory and this use has been forbidden as above, the object cannot be properly constructed.)
The
= delete
specifier can be used to prohibit calling any function, which can be used to disallow calling a member function with particular parameters. For example:An attempt to call
f()
with adouble
will be rejected by the compiler, instead of performing a silent conversion toint
. This can be generalized to disallow calling the function with any type other thanint
as follows:Type
long long int
On 32-bit systems, a
long long
integer type that is at least 64-bits is useful. The C99 standard introduced this type to standard C and it is a long-supported extension by most compilers for C++. (Indeed, some compilers supported it long before its introduction to C99.) C++0x will add this type to standard C++.tatic assertions
The C++ standard provides two methods to test assertions: the macro
assert
and the preprocessor directive#error
. However neither is appropriate for use in templates: the macro tests the assertion at execution-time, while the preprocessor directive tests the assertion during preprocessing, which happens before instantiation of templates. Neither is appropriate for testing properties that are dependent on template parameters.The new utility introduces a new way to test assertions at compile-time, using the new keyword
static_assert
.The declaration assumes the following form: static_assert( "constant-expression", "error-message" ) ;Here are some examples of how
static_assert
can be used:When the constant expression is
false
the compiler produces an error message. The first example represents an alternative to the preprocessor directive#error
, in contrast in the second example the assertion is checked at every instantiation of the template classCheck
.Static assertions are useful outside of templates as well. For instance, a particular implementation of an algorithm might depend on the size of a
long long
being larger than anint
, something the standard does not guarantee. Such an assumption is valid on most systems and compilers, but not all.Allow 'sizeof' to work on members of classes without an explicit object
In standard C++, the sizeof operation can be used on types and objects. But it cannot be used to do the following:
This should return the size of OtherType. C++03 does not allow this, so it is a compile error. C++0x will allow it.
C++ standard library changes
A number of new features will be introduced in the C++0x standard library. Many of these can be implemented under the current standard, but some rely (to a greater or lesser extent) on new C++0x core features.
A large part of the new libraries are defined in the document "C++ Standards Committee's Library Technical Report" (called TR1), which was published in 2005. Various full and partial implementations of TR1 are currently available using the namespace
std::tr1
. For C++0x they will be moved to namespacestd
. However, as TR1 features are brought into the C++0x standard library, they are upgraded where appropriate with C++0x language features that were not available in the initial TR1 version. Also, they may be enhanced with features that were possible under C++03, but were not part of the original TR1 specification.The committee intends to create a second technical report (called TR2) after the standardization of C++0x is complete. Library proposals which are not ready in time for C++0x will be put into TR2 or further technical reports.
The following proposals are under way for C++0x.
Upgrades to standard library components
C++0x offers a number of new language features that the currently existing standard library components can benefit from. For example, most standard library containers can benefit from Rvalue reference based move constructor support, both for quickly moving heavy containers around and for moving the contents of those containers to new memory locations. The standard library components will be upgraded with new C++0x language features where appropriate. These include, but are not necessarily limited to:
* Concepts
* Rvalue references and the associated move support
* Support for the UTF-16 and UTF-32 character types
* Variadic templates (coupled with Rvalue references to allow for perfect forwarding)
* Compile-time constant expressions
* Decltype
* Explicit conversion operators
* Default/Deleted functionsAdditionally, much time has passed since C++ was standardized. A great deal of code using the standard library has been written; this has revealed portions of the standard libraries that could use some improvement. Among the many areas of improvement being considered are standard library allocators. A new scope-based model of allocators will be included in the C++0x to supplement the current model.
Threading facilities
While the C++0x language will provide a memory model that supports threading, the primary support for actually using threading will come with the C++0x standard library.
A thread class will be provided which will take a
function object to run in the new thread. It will be possible to cause a thread to halt until another executing thread completes, providing thread joining support. Access will also be provided, where feasible, to the underlying native thread object(s) for platform specific operations.For synchronization between threads, appropriate mutexes and condition variables will be added to the library. This will be accessible through
RAII locks and locking algorithms for easy use.For high-performance low-level work it is sometimes necessary to communicate between threads without the overhead of mutexes. This is achieved using
atomic operation s on memory locations, together with appropriatememory barrier s. An atomics library will be provided which will allow specifying the minimum synchronization necessary for an operation.High-level threading facilities, particularly futures and
thread pool s have been remanded to a future C++ technical report. They will not be a part of C++0x, but the eventual implementation of them is expected to be built entirely on top of the thread library features.Tuple types
Tuples are collections composed of heterogeneous objects of pre-arranged dimensions. A tuple can be considered a generalization of a struct's member variables.
The C++0x version of the TR1 tuple type will benefit from C++0x features like variadic templates. The TR1 version required an implementation-defined maximum number of contained types, and required substantial macro trickery to implement reasonably. By contrast, the implementation of the C++0x version requires no explicit implementation-defined maximum number of types. Though compilers will almost certainly have an internal maximum recursion depth for template instantiation (which is normal), the C++0x version of tuples will not expose this value to the user.
Using variadic templates, the definition of the tuple class looks as follows:
An example of definition and use of the tuple type:
It’s possible to create the tuple
proof
without defining its contents, but only if the tuple elements' types possess default constructors. Moreover, it’s possible to assign a tuple to another tuple: if the two tuples’ types are the same, it is necessary that each element type possesses a copy constructor; otherwise, it is necessary that each element type of the right-side tuple is convertible to that of the corresponding element type of the left-side tuple or that the corresponding element type of the left-side tuple has a suitable constructor.Relational operators are available (among tuples with the same number of elements), and two expressions are available to check a tuple’s characteristics (only during compilation):
*tuple_size
returns the elements’ number of the tuple ::valueT
,
*tuple_element
returns the type of the object number::type I
of the tupleT
.Hash tables
Including
hash tables (unordered associative containers) in the C++ standard library is one of the most recurring requests. It was not adopted in the current standard due to time constraints only. Although this solution is less efficient than a balanced tree in the worst case (in the presence of many collisions), it performs better in many real applications.Collisions will be managed only through "linear chaining" because the committee doesn’t consider opportune to standardize solutions of "open addressing" that introduce quite a lot of intrinsic problems (above all when erasure of elements is admitted).To avoid name clashes with non-standard libraries that developed their own hash table implementations, the prefix “unordered” will be used instead of “hash”.
The new utility will have four types of hash tables, differentiated by whether or not they accept elements with the same key (unique keys or equivalent keys), and whether they map each key to an associated value.
New classes fulfill all the requirements of a container class, and have all the methods necessary to access elements:
insert
,erase
,begin
,end
.This new utility doesn’t need any C++ language core extensions (though the implementation will take advantage of various C++0x language features), only a small extension of the header
and the introduction of headers
and
. No other changes to any existing standard classes are needed, and it doesn’t depend on any other extensions of the standard library.Regular expressions
Many more or less standardized libraries were created to manage
regular expressions . Since the use of these algorithms is very common, the standard library will include them using all potentialities of anobject oriented language .The new library, defined in the new header
, is made of a couple of new classes:
*regular expressions are represented by instance of the template classbasic_regex
;
*occurrences are represented by instance of the template classmatch_results
.The functionregex_search
is used for searching, while for ‘search and replace’ the functionregex_replace
is used which returns a new string.The algorithmsregex_search
andregex_replace
take a regular expression and a string and write the occurrences found in the structmatch_results
.Here is an example on the use of
match_results
:Note the use of double
backslash es, because the C++ preprocessor uses backslash as an escape character. The C++0x raw string feature could be used to avoid the problem.The library “
regex
” doesn’t need alteration of any existing header (though it will use them where appropriate) and no extension of the core language.General-purpose smart pointers
These pointers are taken from the TR1 smart pointers.
The
shared_ptr
is a reference-counted pointer that acts as much as possible like a regular C++data pointer . The TR1 implementation lacked certain pointer features such as aliasing and pointer arithmetic, but the C++0x version will add these.The shared pointer will automatically destroy its contents only when there are no shared pointers referencing the object originally created for the shared pointer.
A
weak_ptr
is a reference to an object referenced by ashared_ptr
that can determine if that object has been deleted or not.weak_ptr
itself cannot be dereferenced; accessing the actual pointer requires the creation of ashared_ptr
object. This can be done in one of two ways. Theshared_ptr
class has a constructor that takes aweak_ptr
and theweak_ptr
class has alock
member function that returns ashared_ptr
. Theweak_ptr
does not own the object it references, and thus the existence of aweak_ptr
will not prevent the deletion of the object.Here it is an example of use of
shared_ptr
:unique_ptr
will be provided as a replacement forauto_ptr
which will be deprecated. It provides all the features ofauto_ptr
with the exception of unsafe implicit moving from lvalues. Unlikeauto_ptr
,unique_ptr
can be used with the C++0x move-aware containers.Extensible random number facility
The C standard library provides the ability to generate
pseudorandom numbers through the functionrand
. However, the algorithm is delegated entirely to the library vendor. C++ inherited this functionality with no changes, but C++0x will provide a new method for generating pseudorandom numbers.C++0x's random number functionality is split into two parts: a generator engine that contains the random number generator's state and produces the pseudorandom numbers; and a distribution, which determines the range and mathematical distribution of the outcome. These two are combined to form a random number generator object.
Unlike the C standard
rand
, the C++0x mechanism will come with three generator engine algorithms, each with its own strengths and weaknesses:C++0x will also provide a number of standard distributions:
uniform_int
,bernoulli_distribution
,geometric_distribution
,poisson_distribution
,binomial_distribution
,uniform_real
,exponential_distribution
,normal_distribution
, andgamma_distribution
.The generator and distributions are combined as in the following example:
The interface used by
std::variate_generator
is well defined; the user can create both generator engines and distribution objects to use with this class.Wrapper reference
A wrapper reference is obtained from an instance of the template class
reference_wrapper
. Wrapper references are similar to normal references (‘&’) of the C++ language. To obtain a wrapper reference from any object the template classref
is used (for a constant referencecref
is used).Wrapper references are useful above all for template functions, when we need to obtain references to parameters rather than copies:
This new utility will be added to the existing
header and doesn’t need further extensions of the C++ language.Polymorphous wrappers for function objects
Polymorphous wrappers for
function objects (also called “polymorphic function object wrappers”) are similar tofunction pointers in semantics and syntax, but are less tightly bound and can indiscriminately refer to anything which can be called (function pointers, member function pointers, or functors) whose arguments are compatible with those of the wrapper.Through the next example it is possible to understand its characteristics:
The template class
function
will be defined inside the header
, and doesn't require any changes to the C++ language.Type traits for metaprogramming
Metaprogramming consists of creating a program that creates or modifies another program (or itself). This can happen during compilation or during execution. TheC++ Standards Committee has decided to introduce a library that allows metaprogramming during compilation through templates.Here is an example of what is possible, using the actual standard, through metaprogramming: a
recursion of template instances for exponential calculus.Many algorithms can operate on different types of data; C++'s templates support
generic programming and make code more compact and useful. Nevertheless it is common for algorithms to need information on the data types being used. This information can be extracted during instantiation of a template class using type traits.Type traits can identify the category of an object and all the characteristic of a class (or of a struct). They are defined in the new header
.In the next example there is the template function ‘elaborate’ that, depending on the given data types, will instantiate one of the two proposed algorithms (
algorithm.do_it
).Through type traits, defined in header
, it’s also possible to create type transformation operations (static_cast
andconst_cast
are insufficient inside a template).This type of programming produces elegant and concise code; however the weak point of these techniques is the debugging: uncomfortable during compilation and very difficult during program execution.
Uniform method for computing return type of function objects
Determining the return type of a template function object at compile-time is not intuitive, particularly if the return value depends on the parameters of the function. As an example:
Instantiating the class template
calculus
, the function object ofcalculus
will have always the same return type as the function object ofclear
. However, given classconfused
below:Attempting to instantiate
calculus
will cause the return type ofcalculus
to not be the same as that of classconfused
. The compiler may generate warnings about the conversion fromint
todouble
and vice-versa.TR1 introduces, and C++0x adopts, the template class
std::result_of
that allows to determine and use the return type of a function object for every declaration. The objectcalculus_ver2
uses thestd::result_of
object to derive the return type of the function object:In this way in instances of function object ofcalculus_ver2
there are no conversions, warnings, or errors.The only change from the TR1 version of
std::result_of
is that the TR1 version allowed an implementation to fail to be able to determine the result type of a function call. Due to changes to C++ for supportingdecltype
, the C++0x version ofstd::result_of
no longer needs these special cases; implementations are required to compute a type in all cases.ee also
*
ConceptGCC References
C++ Standards Committee papers
*ISO/IEC DTR 19768 (
May 19 ,2008 ) Doc No: 2606 " [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2606.pdf Working Draft, Standard for Programming Language C++] "
*ISO/IEC DTR 19768 (April 29 ,2008 ) Doc No: 2597 " [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2597.html State of C++ Evolution (pre-Antipolis 2008 Meeting)] "
*ISO/IEC DTR 19768 (March 07 ,2008 ) Doc No: N2565 " [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2565.html State of C++ Evolution (post-Bellevue 2008 Meeting)] "
*ISO/IEC DTR 19768 (February 04 ,2008 ) Doc No: N2507 " [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2507.html State of C++ Evolution (pre-Bellevue 2008 Meeting)] "
*ISO/IEC DTR 19768 (October 23 ,2007 ) Doc No: N2432 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2432.html State of C++ Evolution (post-Kona 2007 Meeting)] "
*ISO/IEC DTR 19768 (August 7 ,2007 ) Doc No: N2389 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2389.html State of C++ Evolution (pre-Kona 2007 Meetings)] "
*ISO/IEC DTR 19768 (July 29 ,2007 ) Doc No: N2336 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2336.html State of C++ Evolution (Toronto 2007 Meetings)] "
*ISO/IEC DTR 19768 (June 25 ,2007 ) Doc No: N2291 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2291.html State of C++ Evolution (Toronto 2007 Meetings)] "
*ISO/IEC DTR 19768 (May 3 ,2007 ) Doc No: N2228 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2228.html State of C++ Evolution (Oxford 2007 Meetings)] "
*ISO/IEC DTR 19768 (January 12 ,2007 ) Doc No: N2142 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2142.html State of C++ Evolution (between Portland and Oxford 2007 Meetings)] "
*ISO/IEC DTR 19768 (October 22 ,2007 ) Doc No: N2461 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2461.pdf Working Draft, Standard for programming Language C++] "
*ISO/IEC DTR 19768 (June 24 ,2005 ) Doc No: N1836 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1836.pdf Draft Technical Report on C++ Library Extensions] "
*Lawrence Crowl (May 2 ,2005 ) Doc No: N1815 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1815.html ISO C++ Strategic Plan for Multithreading] "
*Detlef Vollmann (June 24 ,2005 ) Doc No: N1834 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1834.html A Pleading for Reasonable Parallel Processing Support in C++] "
*Lawrence Crowl (May 2 ,2007 ) Doc No: N2280 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n2280.html Thread-Local Storage] "
*Jan Kristoffersen (October 21 ,2002 ) Doc No: N1401 "Atomic operations with multi-threaded environments"
*Hans Boehm, Nick Maclaren (April 21 ,2002 ) Doc No: N2016 "Should volatile Acquire Atomicity and Thread Visibility Semantics?"
*Lois Goldthwaite (October 5 ,2007 ) Doc No: N2437 " [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2437.pdf Explicit Conversion Operators] "
*Alan Talbot, Lois Goldthwaite, Lawrence Crowl, Jens Maurer (February 29 ,2008 ) Doc No: N2544 " [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf Unrestricted unions] "
*Francis Glassborow, Lois Goldthwaite (November 5 ,2004 ) Doc No: N1717 "explicit class and default definitions"
*Bjarne Stroustrup, Gabriel Dos Reis (December 11 ,2005 ) Doc No: N1919 "Initializer lists"
*Herb Sutter, Francis Glassborow (April 6 ,2006 ) Doc No: N1986 "Delegating Constructors (revision 3)"
*Michel Michaud, Michael Wong (October 6 ,2004 ) Doc No: N1898 "Forwarding and inherited constructors"
*Bronek Kozicki (September 9 ,2004 ) Doc No: N1676 "Non-member overloaded copy assignment operator"
*R. Klarer, J. Maddock, B. Dawes, H. Hinnant (October 20 ,2004 ) Doc No: N1720 "Proposal to Add Static Assertions to the Core Language (Revision 3)"
*V Samko; J Willcock, J Järvi, D Gregor, A Lumsdaine (February 26 ,2006 ) Doc No: N1968 "Lambda expressions and closures for C++"
*J. Järvi, B. Stroustrup, D. Gregor, J. Siek, G. Dos Reis (September 12 ,2004 ) Doc No: N1705 "Decltype (and auto)"
*B. Stroustrup, G. Dos Reis, Mat Marcus, Walter E. Brown, Herb Sutter (April 7 ,2003 ) Doc No: N1449 "Proposal to add template aliases to C++"
*Douglas Gregor, Jaakko Järvi, Gary Powell (September 10 ,2004 ) Doc No: N1704 "Variadic Templates: Exploring the Design Space"
*Gabriel Dos Reis, Bjarne Stroustrup (October 20 ,2005 ) Doc No: N1886 "Specifying C++ concepts"
*Daveed Vandevoorde (January 14 ,2005 ) Doc No: N1757 "Right Angle Brackets (Revision 2)"
*Walter E. Brown (October 18 ,2005 ) Doc No: N1891 "Progress toward Opaque Typedefs for C++0X"
*J. Stephen Adamczyk (April 29 ,2005 ) Doc No: N1811 "Adding the long long type to C++ (Revision 3)"
*Chris Uzdavinis, Alisdair Meredith (August 29 ,2005 ) Doc No: N1827 "An Explicit Override Syntax for C++"
*Herb Sutter, David E. Miller (October 21 ,2004 ) Doc No: N1719 "Strongly Typed Enums (revision 1)"
*Matthew Austern (April 9 ,2003 ) Doc No: N1456 "A Proposal to Add Hash Tables to the Standard Library (revision 4)"
*Doug Gregor (November 8 ,2002 ) Doc No: N1403 "Proposal for adding tuple types into the standard library"
*John Maddock (March 3 ,2003 ) Doc No: N1429 "A Proposal to add Regular Expression to the Standard Library"
*P. Dimov, B. Dawes, G. Colvin (March 27 ,2003 ) Doc No: N1450 "A Proposal to Add General Purpose Smart Pointers to the Library Technical Report (Revision 1)"
*Doug Gregor (October 22 ,2002 ) Doc No: N1402 "A Proposal to add a Polymorphic Function Object Wrapper to the Standard Library"
*D. Gregor, P. Dimov (April 9 ,2003 ) Doc No: N1453 "A proposal to add a reference wrapper to the standard library (revision 1)"
*John Maddock (March 3 ,2003 ) Doc No: N1424 "A Proposal to add Type Traits to the Standard Library"
*Daveed Vandevoorde (April 18 ,2003 ) Doc No: N1471 "Reflective Metaprogramming in C++"
*Jens Maurer (April 10 ,2003 ) Doc No: N1452 "A Proposal to Add an Extensible Random Number Facility to the Standard Library (Revision 2)"
*Walter E. Brown (October 28 ,2003 ) Doc No: N1542 "A Proposal to Add Mathematical Special Functions to the C++ Standard Library (version 3)"
*Douglas Gregor, P. Dimov (April 9 ,2003 ) Doc No: N1454 "A uniform method for computing function object return types (revision 1)"Articles
*note label|strousup-brieflook|1|anote label|strousup-brieflook|1|b The C++ Source Bjarne Stroustrup (
January 2 ,2006 ) "A Brief Look at C++0x"
* C/C++ Users Journal Bjarne Stroustrup (May, 2005) "The Design of C++0x: Reinforcing C++’s proven strengths, while moving into the future"
*Web Log di Raffaele Rialdi (September 16 ,2005 ) "Il futuro di C++ raccontato da Herb Sutter"
*Informit.com (August 5 ,2006 ) "The Explicit Conversion Operators Proposal"
*Informit.com (July 25 ,2006 ) "Introducing the Lambda Library"
*Dr. Dobb's Portal Pete Becker (April 11 ,2006 ) "Regular Expressions TR1's regex implementation"
*Informit.com (July 25 ,2006 ) "The Type Traits Library"
*Dr. Dobb's Portal Pete Becker (May 11 ,2005 ) "C++ Function Objects in TR1"
*The C++ Source Howard E. Hinnant, Bjarne Stroustrup, and Bronek Kozicki (March 10 ,2008 ) [http://www.artima.com/cppsource/rvalue.html A Brief Introduction to Rvalue References]External links
* [http://www.open-std.org/jtc1/sc22/wg21/ The C++ Standards Committee]
* [http://www.research.att.com/~bs/ Bjarne Stroustrup's homepage]
* [http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=216 C++0X: The New Face of Standard C++]
* [http://herbsutter.wordpress.com/ Herb Sutter's blog coverage of C++0X]
* [http://www.csclub.uwaterloo.ca/media/C++0x%20-%20An%20Overview.html A talk on C++0x given by Bjarne Stroustrup at the University of Waterloo]
* [http://www.pvv.org/~oma/cpp0x_aquadi_nov_2007.pdf A quick and dirty introduction to C++0x (as of November 2007)]
* [http://www.devx.com/SpecialReports/Article/38813/0/page/1 The State of the Language: An Interview with Bjarne Stroustrup (August 15, 2008)]
Wikimedia Foundation. 2010.