This does not work:
auto A[] = {1, 2, 3, 4};
The reason is that it {1, 2, 3, 4}
displays as initializer_list
which cannot be used to initialize the array. My arguments against this:
If the language can infer the type size initializer_list
, it has no problem doing the same for the array. The output of the template argument will solve the problems of inconsistent types.
initializer_list
should not be containers, while the array may.
It would be nice if the elements were automatically copied to the array and initializer_list
"disappears", as well as the initialization of the array with a string literal. Why is there no special rule for this?
source
share