Konstanter Ausdrucksinitialisierer für statische Klassenmember vom Typ double
In C ++ 11 und C ++ 14, warum brauche ichconstexpr
im folgenden Snippet:
class Foo {
static constexpr double X = 0.75;
};
Hierdurch wird ein Compilerfehler erzeugt:
class Foo {
static const double X = 0.75;
};
und (überraschenderweise) dies ohne Fehler kompiliert?
class Foo {
static const double X;
};
const double Foo::X = 0.75;