I\'m reading the C++11 standard, but can\'t figure out whether
T x{};
is value-initialized or default initialized (automatic storage). It
Although Matt McNabb has already covered this, I will add that if you have trouble navigating through the standard, it doesn't hurt to check out cppreference. Their section on list initialization breaks it down pretty well.
Essentially, like your standard quote says, T x{};
refers to an:
initialization of a named variable with a brace-enclosed list of expressions or nested lists (braced-init-list).
And:
The effects of list initialization of an object of type T are:
- If the braced-init-list is empty and T is a class type with a default constructor, value-initialization is performed.
[...]
- Otherwise, if the braced-init-list has no elements, T is value-initialized.