高洛峰2017-04-17 15:27:50
You can refer to the "CPP Core Guidelines" recently written by Bjarne Stroustrup, which is mentioned in Article C.48:
Prefer in-class initializers to member initializers in constructors for constant initializers
The conclusion is to give priority to putting it in in-class, that is, initialize it when the members are defined. Because if there are multiple constructors, it may cause inconsistencies and some easy misunderstandings. Detailed answers can be found here.
黄舟2017-04-17 15:27:50
It depends on the specific context. Generally speaking, I suggest that the storage application be initialized when it is defined.
Other single Init function