Is the following syntax:
T t = {};
a zero-initalization or a value-initalization that for non-POD types is zero-initialization?
Is the following syntax:
T t = {};
a zero-initalization or a value-initalization that for non-POD types is zero-initialization?
The syntax T object = {arg1, arg2, ...}; is copy list initialization. Since you established that T is not an aggregate type and that T has a default constructor (from the list) then list initialization will perform value initialization :
- If
Tis an aggregate type, aggregate initialization is performed.- Otherwise, if the braced-init-list is empty and
Tis a class type with a default constructor, value-initialization is performed.