Initializing objects with new {} syntax like this:
int a { 123 };
has benefit - you would not declare a function instead of creating a variable by mistake. I even heard that it should be habit to always do that. But see what could happen:
// I want to create vector with 5 ones in it:
std::vector<int> vi{ 5, 1 }; // ups we have vector with 5 and 1.
Is this good habit then? Is there a way to avoid such problems?
See Question&Answers more detail:os