Date: Tue, 6 Sep 2022 14:28:56 -0400
On Tue, Sep 6, 2022 at 1:43 PM Anoop Rana via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> I came to know 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 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:
>
> > 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?
To the extent that "user-declared" is not self-explanatory, the
problem is merely that "user-declared" is not defined anywhere. It's
not about constructors specifically, and there are plenty of uses of
"user-declared X" in the standard. So if this is a problem, the
problem is the lack of a clear definition of what it means for a thing
to be "user-declared".
<std-discussion_at_[hidden]> wrote:
>
> I came to know 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 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:
>
> > 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?
To the extent that "user-declared" is not self-explanatory, the
problem is merely that "user-declared" is not defined anywhere. It's
not about constructors specifically, and there are plenty of uses of
"user-declared X" in the standard. So if this is a problem, the
problem is the lack of a clear definition of what it means for a thing
to be "user-declared".
Received on 2022-09-06 18:29:30