3 ms·
I'd be fully in support of that if it weren't for the fact that initializer_lists end up causing their own sets of issues. For instance, type-inference is comp
by jeorgun 12y ago
I'd be fully in support of that if it weren't for the fact that initializer_lists end up causing their own sets of issues.
For instance, type-inference is completely borked:
auto foo{tmp};
results in
std::initializer_list<decltype(tmp)>
Not to mention issues such as
std::vector<int>{ 3, 4 } // => [3, 4]
vs
std::vector<int>( 3, 4 ) // => [4, 4, 4, 4]
Unless some alternate syntax is proposed for initializer_lists, the old syntactic forms are kind of indispensable.
- nly 12y agoThere's a proposal to fix the 'foo' case but, as an outsider, it's unclear whether it will be fixed in time for C++14. [0] The vector case is unfortunate, but I'd personally argue the defect is in the vector class. There's no significant performance advantage, that I can see, to the (n, T) construction over a default construction followed by v.resize(n, T). [0] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3922.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n392...