This depends on what you mean by "always using brace-initialization". If you convert a constructor like
X x(a, b, c);
into
X x{a, b, c};
(and the behavior doesn't change due to a different constructor getting picked) then the generated code shouldn't get any more or less efficient. On the other hand:
std::vector<std::string> v{
"long character string a",
"long character string b",
"long character string c"};
may well be less efficient than
std::vector<std::string> v;
v.push_back("long character string a");
v.push_back("long character string b");
v.push_back("long character string c");
because of the problem @dyp mentioned, that the vector can't move out of the initializer_list
.
advertisementblog post? (And are there any good refutations of it?) – dyp Mar 17 '14 at 13:10