C++ Logo

std-discussion

Advanced search

Is the term user-declared constructor ambiguous or is it self explanatory

From: Anoop Rana <ranaanoop986_at_[hidden]>
Date: Tue, 6 Sep 2022 23:13:25 +0530
I came to know
<https://stackoverflow.com/questions/73624520/whats-the-definition-of-user-declared-constructor-in-the-c-standard>
that the C++ standard doesn't define the term *user-declared constructor*
but it uses that term at many places. Now to my current understanding, the
term *user-declared constructor* is self explanatory.

But one user disagrees with my above understanding as they say
<https://stackoverflow.com/questions/73624520/whats-the-definition-of-user-declared-constructor-in-the-c-standard#comment130012905_73624520>
the following:

> It's not entirely self explanatory. The place things get tricky is with
special member functions of things in the standard library. Even though a
normal user never writes the code for constructors of things like
std::string, I believe those still fall within the realm of "user declared"
special member functions--but I can't quote anything from the standard to
back that up, and there are fair arguments to be made that they're not.

*(end quote)*

The same user further says
<https://stackoverflow.com/questions/73624520/whats-the-definition-of-user-declared-constructor-in-the-c-standard#comment130013030_73624520>
:

> In fact, I've talked with a committee member about this who agreed it was
ambiguous and should be defined (but was busy with enough other things he
wasn't willing to delay them to work on this)

*(end quote)*

So *my question is* that should the term *user-declared constructors* be
defined by the standard? That is, is there any example where there is some
ambiguity due to the term as said in the above quoted comment or is the
term self-explanatory. Basically, what ambiguity the user(quoted above) is
talking about?


My current understanding is that the term *user-declared* in this context
means(or is same as) "*written by some user and whoever that user maybe as
long as it is not implicitly synthesized by the compiler"*. Is my
understanding that the term *user-declared constructor *is self explanatory
and there is no need to define it in the standard correct?

Received on 2022-09-06 17:43:37