Just define it in the header:
template <typename T>
struct S
{
static double something_relevant;
};
template <typename T>
double S<T>::something_relevant = 1.5;
Since it is part of a template, as with all templates the compiler will make sure it’s only defined once.
More Related Contents:
- Template static variable
- C++ static template member, one instance for each template type?
- static member initialization for specialized template class
- overloading friend operator
- Unresolved external symbol on static class members
- Undefined reference to static variable c++
- Variadic template pack expansion
- std::function vs template
- explicit specialization of template class member function
- Template specialization of particular members?
- c++ template partial specialization member function [duplicate]
- What is the partial ordering procedure in template deduction
- Default template arguments for function templates
- C++11: I can go from multiple args to tuple, but can I go from tuple to multiple args? [duplicate]
- Why can’t the compiler deduce the template type from default arguments?
- How to cin values into a vector
- Are static variables in a base class shared by all derived classes?
- What is the difference between a static and const variable?
- Why can I call base template class method from derived class
- C++ – Why static member function can’t be created with ‘const’ qualifier
- Is there a compiler bug exposed by my implementation of an is_complete type trait?
- Returning a void?
- Is casting std::pair const& to std::pair const& safe?
- Why do the usual access control checking applies to names used to specify explicit instantiation when accessed through template parameters?
- Local type as template arguments in C++ [duplicate]
- Default values in templates with template arguments ( C++ )
- Obtain container type from (its) iterator type in C++ (STL)
- Template type deduction in C++ for Class vs Function?
- How does std::forward receive the correct argument?
- C++, static vs. namespace vs. singleton