I want to run this code:
struct A {
static const string d[] = {"1", "2"};
};
And get an error:
error: in-class initialization of static data member ‘const string A::d []’ of incomplete type
static const string d[] = {"1", "2"};
^
error: non-constant in-class initialization invalid for non-inline static member ‘A::d’
static const string d[] = {"1", "2"};
^
note: (an out of class initialization is required)
Here I find information that now I can initialize what I want. So what the problem?
If I add inline
then it will work:
struct A {
static const inline string d[] = {"1", "2"};
};
Aucun commentaire:
Enregistrer un commentaire