In C++ when using initializer_list syntax to initialize an object, the regular constructors of the object also participate in overload resolution, when no other list initialization rule applies. As far as I understand it, the following code calls X::X(int)
class X { int a_; X(int a):a_(a) {} );
void foo() {
X bar{3};
}
But I don't understand, why regular constructors also are considered in context of initializer_lists. I feel that a lot of programmers now write X{3} to call a constructor instead of X(3) to call the construcor. I don't like this style at all, as it makes me think the object does not have a regular constructor.
What is the reason why the initializer_list syntax can also be used to call regular constructor? Is there a reason to now prefer this syntax over regular constructor calls?