CodingKnight's blog

By CodingKnight, 6 weeks ago, In English

Hello Codeforces Community,

Congratulations for the installation of C++20 automatic judge. A word of gratitude and appreciation is due to the Codeforces administration team for their endeavors to keep Codeforces up-to-date with the latest developments in C++.

The following program is an example for one of the new features introduced in C++20, __cpp_aggregate_paren_init.

Initializing aggregates from a parenthesized list of values

The following is the expected output of this program.


This program produces a compilation error when compiled using GNU++17 9.2.0 compiler, but can be compiled successfully using GNU++20 11.2.0 compiler. The C++20 compiler translates that statement const FourDPoint p(1,2,3,4) into initializing the data members w, x, y, z of the constant object p to 1, 2, 3, and 4, respectively. Similarly, the compiler passes the initialization list {5,6,7,8} to the constructor of the base class array<int,4>, even though both classes FourDPoint and Array<int,4> do not have explicit class constructors.

  • Vote: I like it
  • +10
  • Vote: I do not like it