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.
It depends on the specific context. Generally speaking, I suggest that the storage application be initialized when it is defined. Other single Init function
You can refer to the "CPP Core Guidelines" recently written by Bjarne Stroustrup, which is mentioned in Article C.48:
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.
It depends on the specific context. Generally speaking, I suggest that the storage application be initialized when it is defined.
Other single Init function