[eigen] About Complex numbers Todo

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


It seems that the rationale of implementing a new complex class could disappear.

According to the draft of the next standard C++0x (at this proposition
is well acknowledged since 2002 see below):

Section 26.4 p 886
say that complex is always an array (I have quote at the end of the
mail), the wording was especially choosen in order to be Fortran
compatible and C99 compatible (see
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#387 and the
last remark about
"All existing implementations already have the layout proposed here").

Thus I think we could remove this todos item, if you want to be safe
you could publish a test case and use crash the compilation. I could
write a cmake test case if you want


The standard:
2 The effect of instantiating the template complex for any type other
than float, double, or long double
is unspecified. The specializations complex<float>, complex<double>,
and complex<long double> are
literal types (3.9).
3 If the result of a function is not mathematically defined or not in
the range of representable values for its
type, the behavior is undefined.
4 If z is an lvalue expression of type cv std::complex<T> then:
— the expression reinterpret_cast<cv T(&)[2]>(z) shall be well-formed,
— reinterpret_cast<cv T(&)[2]>(z)[0] shall designate the real part of z, and
— reinterpret_cast<cv T(&)[2]>(z)[1] shall designate the imaginary part of z.
Moreover, if a is an expression of type cv std::complex<T>* and the
expression a[i] is well-defined for an
integer expression i, then:
— reinterpret_cast<cv T*>(a)[2*i] shall designate the real part of a[i], and
— reinterpret_cast<cv T*>(a)[2*i + 1] shall designate the imaginary
part of a[i].

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/