28 Numerics library [numerics]

28.9 Basic linear algebra algorithms [linalg]

28.9.7 Exposition-only helpers [linalg.helpers] imag-if-needed [linalg.helpers.imag]

The name imag-if-needed denotes an exposition-only function object.
The expression imag-if-needed(E) for a subexpression E whose type is T is expression-equivalent to:
  • imag(E), if T is not an arithmetic type and the expression imag(E) is valid, with overload resolution performed in a context that includes the declaration template<class T> T imag(const T&) = delete;
    If the function selected by overload resolution does not return the imaginary part of its input, the program is ill-formed, no diagnostic required;
  • otherwise, ((void)E, T{}).