May 2017
Intermediate to advanced
590 pages
17h 18m
English
The following sample shows several examples of direct-list-initialization and copy-list-initialization. In C++11, the deduced type of all these expressions is std::initializer_list<int>.
auto a = {42}; // std::initializer_list<int>auto b {42}; // std::initializer_list<int>auto c = {4, 2}; // std::initializer_list<int>auto d {4, 2}; // std::initializer_list<int>
C++17 has changed the rules for list initialization, differentiating between the direct- and copy-list-initialization. The new rules for type deduction are as follows:
Read now
Unlock full access