P
pietro.cerutti
I'm wondering what would prevent an initialization list from being a first-class expression of type std::initializer_list.
I understand that the current standar allows braced-init-lists to appear only when assigning to a scalar of type T or to an object of a class taking an std::initializer_list in the assignment operator.
Having
void f (std::vector<double> v);
It is currently possible to do this:
auto a {1, 2, 3}:
g (a);
but not to do this:
g ({1, 2, 3});
As I see it, all information the compiler needs is there. Is there any specific reason why this isn't possible?
Thanks,
I understand that the current standar allows braced-init-lists to appear only when assigning to a scalar of type T or to an object of a class taking an std::initializer_list in the assignment operator.
Having
void f (std::vector<double> v);
It is currently possible to do this:
auto a {1, 2, 3}:
g (a);
but not to do this:
g ({1, 2, 3});
As I see it, all information the compiler needs is there. Is there any specific reason why this isn't possible?
Thanks,