harttle.github.io icon indicating copy to clipboard operation
harttle.github.io copied to clipboard

2015/07/22/effective-cpp-4

Open utterances-bot opened this issue 7 years ago • 2 comments

Effective C++ 4:确保变量的初始化 | Harttle Land

出于效率原因,C++不保证非成员对象的内置型的初始化。对于成员变量的内置类型,会在构造函数进入之前进行初始化。

https://harttle.land/2015/07/22/effective-cpp-4.html

utterances-bot avatar Dec 04 '18 02:12 utterances-bot

想问一下,封闭类对应的英文术语是啥?

ghost avatar Dec 04 '18 02:12 ghost

一旦声明了任何形式的构造函数(包括拷贝构造函数),编译器将不会生成默认的无参构造函数。所以上述的无参数的构造函数可以省略。 => 这句是不是应该为无参构造函数不可以省略。因为既然不会生成默认的无参构造函数,但是单例中又用到了无参构造,所以不能省略

Syh-git1 avatar May 10 '22 06:05 Syh-git1