Top "List-initialization" questions

In C++11 list-initialization refers to initializing a variable using curly braces

Why is list initialization (using curly braces) better than the alternatives?

MyClass a1 {a}; // clearer and less error-prone than the other three MyClass a2 = {a}; MyClass a3 = a; MyClass a4(a); …

c++ c++11 syntax initialization list-initialization
What does "return {}" statement mean in C++11?

What does the statement return {}; in C++11 indicate, and when to use it instead of (say) return NULL; or return …

c++ c++11 return return-value list-initialization
Why can I not brace initialize a struct derived from another struct?

When I run this code: struct X { int a; }; struct Y : public X {}; X x = {0}; Y Y = {0}; I get: error: …

c++ c++11 struct list-initialization
How should I brace-initialize an std::array of std::pairs?

std::array<std::pair<int, int>, 2> ids = { { 0, 1 }, { 1, 2 } }; VS2013 error: error C2440: 'initializing' : cannot convert from 'int' …

c++ c++11 std-pair stdarray list-initialization
Deleted default constructor. Objects can still be created... sometimes

The naive, optimistic and oh.. so wrong view of the c++11 uniform initialization syntax I thought that since C++11 user-defined …

c++ c++14 language-lawyer list-initialization aggregate-initialization