Skip to content

Specialize xtl::xcomplex for non references #253

@JohanMabille

Description

@JohanMabille

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions