Non-Static Data Member Initializers -- 741MHz

In case you missed it:

Non-Static Data Member Initializers

by 741MHz

From the article:

...  This problem is addressed in C++11 by allowing non-static data members to be initialized along with a declaration. For example, the following syntax is allowed:

struct foo {
    double x = 1.23;
    int y = 1;
    int z = 2;
};

This also works well with multiple constructors. The class described above could now be simplified and made easier to maintain further down the road: ...

 

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.