C++ Committee Meeting Trip Report: Oulu, 2016
The C++17 release cycle is nearing its end. At this meeting, a Committee Draft (CD) had been produced that will be reviewed by National Bodies around the world before the actual standard ships.
The meeting was held in Oulu, Finland, 20-25th of June. There were slightly fewer people than usual (IMO); at the same time, the Core Working Group attendance was remarkably high - sometimes, more that 20 people were in the room. This was also the first meeting where the Russian National Body was represented (by two Yandex employees from Moscow).
The committee successfully voted for adoption of the C++17 Committee Draft (CD) available as N4594 plus many edits that had been approved during the meeting. There will be at least two more meetings where changes to that document could be made, so it is far from being final. It is generally expected that no major changes are done at this stage, but things happen and they had happened in the past with C++11, so it’s always early to kick back and relax when it’s about the C++ standard.
Major changes (from my point of view) include:
-
Core issue 2022. Copy elision in constant expressions
Copy elision in constant expressions is mandatory now.
-
Core issue 2171. Triviality of copy constructor with less-qualified parameter
Triviality of defaulted constructor with less-const-qualified parameter type than the implicit declaration has been reconsidered.
-
New features:
-
P0028R4 Using attribute namespaces without repetition
Ex.:
[[ using CC: opt(1), debug ]]
, no need to prefix “opt” and “debug” with “CC::” -
P0035R4 Dynamic memory allocation for over-aligned data
Extends set of operators new/delete with ones accepting required alignment.
Ex.:
void* operator new(std::size_t, std::align_val_t);
-
P0091R3 Template argument deduction for class templates (Rev. 6)
Instead of writing
A<int> a(10);
one would be able to writeA a(10);
and let the compiler deduce the class template arguments from the constructor’s parameters (almost like auto-generated make_*() factory functions). -
P0127R2 Declaring non-type template parameters with auto
template <auto N> class A;
meaning that type of “N” will be deduced from declaration likeA<'x'>
. -
P0135R1 Wording for guaranteed copy elision through simplified value categories
Copy elision is made obligatory in some situations like returns from functions; this includes removal of checking for presence and accessibility of copy/move constructors when copy is not actually made.
-
P0145R3 Refining Expression Evaluation Order for Idiomatic C++
Order of evaluation is now set for these expressions (“a” is evaluated before “b”):
a.b, a->b, a->*b, a(b), b @= a, a[b], a << b, a >> b
Other expressions are untouched, as well as order of evaluation of function’s parameters, which are still indeterminably sequenced with no interleaving. -
P0292R2 constexpr if: A slightly different syntax
Introduces new statement:
if constexpr
; the “false” part of such statement does not cause ODR-use and, if inside a temploid, does not get instantiated (but still parsed). -
P0386R2 Inline Variables
The
inline
specifier for a variable definition means that it being defined in several translation units does not cause ODR violation. We don’t have to define static data members in .cpp anymore. -
P0217R3: Proposed wording for structured bindings
Decompose structs, tuples and arrays into components with automatically-deduced types.
Ex.:
struct S { int x1; double y1; } s; const auto [ x, y ] = s;
-
P0305R1: Selection statements with initializer
Introduce
if (init; condition)
andswitch (init; condition)
(cheers in the audience) -
P0398R0: Core issue 1518: Explicit default constructors and copy-list-initialization
Class with explicit default constructor is no longer an aggregate.
-
The next meeting is in Issaquah, WA, USA from 2016-11-07 to -12; CWG is going to be focused on addressing comments from National Bodies.
References
- Pre-meeting mailing - this is where you can find almost all the papers presented at the meeting
- The C++ Committee
- The committee meetings schedule