Quick Q: Why would I use =default? -- StackOverflow

Quick A: Not just for convenience, but sometimes it matters for PODness or optimal performance.

From SO:

The new keyword =default in C++11

I don't understand why would I ever do this:

struct S {
    int a;
    S(int aa) : a(aa) {}
    S() = default;
};

Why not just say:

S() {} // instead of S() = default;

why bring in a new keyword for that?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.