Assume that you have code like this:
class A {
private:
static const std::string Name = "jo";
//other things
};
I'm seeing conflicting guidelines on above. Some guidelines say always use char* for static const while some don't care. I understand static initialization order fiasco and one point of failure is std::string class is uninitialized when above line runs and something funky happens because of internal implementation.
My question is:
Does static initialization order fiasco apply to above? Is above good idea vs defining static method that returns local const or using char* ?
Aucun commentaire:
Enregistrer un commentaire