cpp/numeric/complex

Specializations of for cv-unqualified  floating-point types are  s for representing and manipulating.

Array-oriented access
For any object of type,  is the real part of  and  is the imaginary part of.

For any pointer to an element of an array of named  and any valid array index,  is the real part of the complex number , and  is the imaginary part of the complex number.

The intent of this requirement is to preserve binary compatibility between the C++ library complex number types and the C language complex number types (and arrays thereof), which have an identical object representation requirement.

Implementation notes
In order to satisfy the requirements of array-oriented access, an implementation is constrained to store the real and imaginary parts of a specialization in separate and adjacent memory locations. Possible declarations for its non-static data members include:


 * an array of type, with the first element holding the real part and the second element holding the imaginary part (e.g. Microsoft Visual Studio);
 * a single member of type (encapsulating the corresponding C language complex number type) (e.g. GNU libstdc++);
 * two members of type, with the same member access, holding the real and the imaginary parts respectively (e.g. LLVM libc++).

An implementation cannot declare additional non-static data members that would occupy storage disjoint from the real and imaginary parts, and must ensure that the class template specialization does not contain any padding bit. The implementation must also ensure that optimizations to array access account for the possibility that a pointer to may be aliasing a  specialization or array thereof.