C++ Logo


Advanced search

Subject: Re: Aggregate elements
From: Jason Cobb (jason.e.cobb_at_[hidden])
Date: 2020-12-11 13:41:25

On 12/11/20 2:38 PM, Vladimir Grigoriev via Std-Discussion wrote:
> In this declaration
> B b = { 1, 2 };
> there is initialized the object b of the aggregate B. The aggregate B
> has two elements: the direct base class A and the data member z.
> According to the quote
> (3.2) -- If the initializer list is an initializer-list, the explicitly
> initialized elements of the aggregate are the first n elements of the
> aggregate, where n is the number of elements in the initializer list.
> first two elements of the aggregate B are being  initialized. But this
> is not true. Only the single element that is the direct class A is
> initialized explicitly. So the quote  contradicts the realty.
> With best regards
> (Vlad from Moscow)
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com

This is brace elision; see [dcl.init.aggr]/16.

Jason Cobb
Assessor, Rulekeepor, Stonemason

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups