Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Default-constructors

21 views
Skip to first unread message
Message has been deleted

Victor Bazarov

unread,
Jun 19, 2015, 2:10:22 PM6/19/15
to
On 6/19/2015 1:57 PM, Stefan Ram wrote:
> C++ seems to differentiate between all those cases (e.g.,
> when one needs to find out how something is initialized):
>
> A - A class has a default-constructor declared in the
> class specifier.¹

"...declared in the class _definition_." (the "class specifier" is
something completely different, I believe).

>
> B - A class does not have a default-constructor
> declared in the class-specifier, but the language
> »has generated« a default constructor.²
>
> C - A class has default-constructor declared in the
> class specifier with »= deleted«.
>
> D - A class has no default constructor.
>
> Did I miss a case?
>
> There also is the case of a »defaulted default constructor«!
> I believe that this means a default constructor that was
> declared with »= default«. Does this count as a subcase of
> case A or of case B for the sake of reading the standard?

Class B, I'd say.

> The last case can happen, I believe, when the user has
> declared another constructor, so there will be no
> default-constructor »generated«. I found it mildly
> surprising that having a deleted default-constructor
> is not the same as having no default-constructor!

And in C++11 you need to specify what you mean by "having no
default-constructor" since the absence of the default c-tor can be due
to different causes.

> The standard also uses »implicitly deleted default constructor«.
> This seems to refer to case D?

Most likely.

> 1) I believe that this is also known as a
> »user-declared« or »user-defined« default-constructor.
>
> 2) I believe that this is also known as an
> »implicit« default-constructor or an
> »implicitly declared« default-constructor.
>

V
--
I do not respond to top-posted replies, please don't ask
Message has been deleted
Message has been deleted
0 new messages