Initializing static template member

Since it is part of a template, as with all templates the compiler will make sure it’s only defined once. - SO

template <typename T>
struct S
{
    static double something_relevant;
};

template <typename T>
double S<T>::something_relevant = 1.5;
Written on March 24, 2019, Last update on March 27, 2021
c++