lundi 14 mai 2018

Why I am getting this error: constexpr' is not valid here

I have this code:

class myClass
{
        constexpr int x = 4;
};

and on visual studio 2015, I am getting this error:

'constexpr' is not valid here

Why I am getting this error? I want a const static variable that I can initlaize it on header file.

In the next step I want to change my class to a template, but this constant is not related to the type of clas.

Aucun commentaire:

Enregistrer un commentaire