Provide a definition for numeric_limits static data members

Authored by majnemer@google.com

Provide a definition for numeric_limits static data members

Eigen provides specializations which have static data member initializers. However, const non-inline static data members which are ODR used must have a definition at namespace scope.

We cannot use C++17 inline variables to solve this so we must come up with another, wordier, solution.

Move the implementation into a class template. Provide a definition for the data members. Because they are templated, we are safe from ODR violations. Make the std::numeric_limits specializations inherit from the helper class template. Note that the class template’s template parameter is not meaningful, we only need it because we want to be able to have the static data member emitted into a COMDAT linker section.

Merge request reports

Loading