On Tue, Feb 14, 2023 at 10:12 PM Gergely Nagy via Std-Proposals
<std-proposals@lists.isocpp.org> wrote:
>
> std::vector<Trivial> t;
> t.emplace_back(1, 2.0, "blah");
I always used to use compound literals for this purpose:
t.emplace_back( (Trivial){1,2.0,"blah"} );
Why, when you could just use aggregate initialization?
t.emplace_back( Trivial{1,2.0,"blah"} );
Strictly speaking I think these compound literals are only a feature
of C, but every C++ compiler supports them.
Ville posted "C++20 allows initializing aggregates with the
parenthesized syntax", so does that mean we pretty much have compound
literals in C++ except that we use the following syntax?
Trivial(1,2.0,"blah")
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals