This question has also been submitted to Usenet, where it is more appropriate, but this is a larger and more reliable forum.
std::allocator::construct
is defined to forward its argument parameter
pack to object construction using parentheses, a.k.a. direct-initialization.
If it used braces, a.k.a. uniform initialization, we could initialize
aggregate data types from functions such as std::make_shared
and
container::emplace
. Also, it would be acceptable to put the contents
of an initializer list into the argument list of such a function,
solving the problem of initializer_list
type deduction under
forwarding.
Was this alternative considered and rejected? Is it too late to switch in a future standard? It seems this would be a breaking change, but not a particularly heinous one.
I don't know what the SC considered, but keep in mind that uniform initialization doesn't really 'work' in generic contexts (barring value construction*). Consider this attempt:
You get:
and this doesn't compile:
whereas this does:
If the particular interaction between perfect forwarding and initializer lists that causes this was formalized soon enough I could see the SC not wanting to restart from scratch.
(*):
T {}
is fine even in generic contexts.