[units] objects with internal linkage in headers

AMDG All the static const objects in the library cause ODR violations for functions that use them. You can avoid this by only putting a reference in the unnamed namespace. #define BOOST_UNITS_STATIC_CONSTANT(type, name) \ template<bool> struct name##_intance_t { \ static const type instance; \ }; \ namespace { \ const type& name(name##_intance_t<true>::instance);\ } \ template<bool b> \ type name##_intance_t<b>::instance BOOST_UNITS_STATIC_CONSTANT(energy, joule); BOOST_UNITS_STATIC_CONSTANT(typeof(1.0*meters/second) , c) = 299792458*meters/second; In Christ, Steven Watanabe
participants (1)
-
Steven Watanabe