Are there any performance issues with the brace-init command in C ++ 11?

I am considering reorganizing a medium-sized database, always using the parenthesis function. Are there any performance issues I should be aware of?

A few examples can be POD types and built-in types, as well as large classes with many design parameters?

+4
source share
1 answer

It depends on what you mean by "always using the parenthesis function." If you convert a constructor like

X x(a, b, c);

at

X x{a, b, c};

( - ), . :

std::vector<std::string> v{
    "long character string a",
    "long character string b",
    "long character string c"};

,

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");

- @dyp , initializer_list.

+1

Source: https://habr.com/ru/post/1532025/


All Articles