Mark Ransom
Mark Ransom

Reputation: 308130

Is inheriting constructors part of the standard?

I just learned today that it's possible to inherit a constructor with a using statement: https://stackoverflow.com/a/20062289/5987

The question is if this is specified by the standard or if it's an extension by certain compilers. If it is part of the standard, was it introduced in C++11?

Upvotes: 3

Views: 169

Answers (2)

It was introduced in the C++11, but as mentionned in the previous question, since it is fairly new, only a few compilers support this feature.

Upvotes: 0

Casey
Casey

Reputation: 42554

Yes, it's standard. Yes, it was added in C++11:

C++11 § 12.9 Inheriting Constructors [class.inhctor]:

A using-declaration (7.3.3) that names a constructor implicitly declares a set of inheriting constructors. The candidate set of inherited constructors from the class X named in the using-declaration consists of actual constructors and notional constructors that result from the transformation of defaulted parameters as follows: ...

Upvotes: 5

Related Questions