Optimization due to constructor initializer list

后端 未结 8 1781
故里飘歌
故里飘歌 2020-12-13 21:23

Constructors should initialize all its member objects through initializer list if possible. It is more efficient than building the constructors via assign

8条回答
  •  时光取名叫无心
    2020-12-13 22:21

    Well, otherwise you call the default constructor and then perform an assignment. That's one step longer and may get really inefficient depending on the nature of initialization.

提交回复
热议问题