在C++11中,对于初始化int类型的常量数据成员,以下四种不同的语法是否具有相同的效果?如果不是,它们之间有什么区别?
{
const int a = 5; //usual initialization, "=" is not assignment operator here it is an initialization operator.
}
{
const int a(5); //calling the constructor function directly
}
{
const int a = {5}; //similar to initializing an array
}
{
const int a{5}; //it should work, but visual studio does not recognizing it
}
为什么第四个语句在Visual Studio中无法被识别为有效语句?