Why should I prefer to use member initialization lists?

后端 未结 9 1286
醉酒成梦
醉酒成梦 2020-11-21 04:43

I\'m partial to using member initialization lists with my constructors... but I\'ve long since forgotten the reasons behind this...

Do you use member initialization

9条回答
  •  遥遥无期
    2020-11-21 05:33

    As explained in the C++ Core Guidelines C.49: Prefer initialization to assignment in constructors it prevents unnecessary calls to default constructors.

提交回复
热议问题