samedi 21 juillet 2018

Building error in constexpr

I am using constexpr in my application and I am getting compilation error.

namespace {
   const int kLength = 1;
   const float kPiNumber = 3.14159265;
   constexpr float kCircumferenceArc()
   { return (2*kPiNumber*kLength) / 360; }
}

And the error I am getting is:

read of non-constexpr variable 'kPiNumber' is not allowed in a constant expression { return (2*kPiNumber) / 360; }

Could someone help me on this?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire