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

Re: direct-initialization

27 views
Skip to first unread message
Message has been deleted

Victor Bazarov

unread,
Jun 30, 2015, 4:52:38 PM6/30/15
to
On 6/30/2015 4:31 PM, Stefan Ram wrote:
> 5.5p16 says:

Really? The paragraph 5.5/16 doesn't exist in the document I use. Did
you mean 8.5/16?

>
> The initialization that occurs in the forms
> T x(a);
> T x{a};
> (...) is called direct-initialization.
>
> (End of quotation).
>
> Is »a« a single expression above?

Most likely. It's written as an opposite form of the T x = a; described
in the preceding paragraph, and relates to the paragraph that starts
with "The form of initialization". They are talking of a single
expression there.

> So,
>
> ::std::string s( 3, 'c' );
>
> is not a direct-initialization because there
> is not a single expression in the parentheses?
>
> If this is true, what kind of initialization is it?

It is direct. See just lower, "If the destination type is a .. class type:"

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

Victor Bazarov

unread,
Jun 30, 2015, 5:57:46 PM6/30/15
to
On 6/30/2015 5:07 PM, Stefan Ram wrote:
> Victor Bazarov <v.ba...@comcast.invalid> writes:
>> On 6/30/2015 4:31 PM, Stefan Ram wrote:
>>> 5.5p16 says:
>> Really? The paragraph 5.5/16 doesn't exist in the document I use. Did
>> you mean 8.5/16?
>
> Yes. Sorry, that was a typo!
>
>> It is direct. See just lower, "If the destination type is a .. class type:"
>
> The parapraph 17 seems just intended to give the semantics
> once the kind of initialization syntax is already determined.

"If the entity being initialized does not have class type, the
expression-list in a parenthesized initializer shall
be a single expression."

From p16 I conclude that in a class type the direct initialization can
take the form

T x(a);
or
T x{a};

in which 'a' does *not* have to be a single expression (see p13).
Message has been deleted

Victor Bazarov

unread,
Jun 30, 2015, 8:52:08 PM6/30/15
to
> That quotation from above did not explictly refer to
> direct-initializations only AFAIK.

No, but the definition of 'direct-initialization' specifies those two
forms. The 'If the entry being...' portion provides a special case for
non-class objects.

>
> It is possible that the form
>
> T x( a, b )
>
> is also an initialization, but not a direct-initialization
> (it is possible that it is neither a copy-initialization nor
> a direct-initialization, but just »an initialization«). The
> quotation than could refer to this.

There is no such thing as "just an initialization". They are all either
direct- or copy- or default- or zero- or value- or list-. There is no
other type.
0 new messages