xtl
xtl copied to clipboard
Specialize xtl::xcomplex for non references
The current implementation of xtl::xcomplex prevents to reinterpret_cast it into an array of the underlying value_type, like one can do with std::complex (see http://eel.is/c++draft/complex.numbers.general). This is because xtl::complex stores the real and imaginay parts as two double. Even if this is almost always possible to reinterpret cast such a structure into an array, it is undefined behavior according to the standard.
A fix would be to specialize the implementation of xtl::xcomplex when its template parameters are not references. This would be a backward compatible change since only the storage of the data would change, not the APIs.
cc @serge-sans-paille