28 Numerics library [numerics]

28.9 Basic linear algebra algorithms [linalg]

28.9.7 Exposition-only helpers [linalg.helpers]

28.9.7.1 abs-if-needed [linalg.helpers.abs]

The name abs-if-needed denotes an exposition-only function object.
The expression abs-if-needed(E) for a subexpression E whose type is T is expression-equivalent to:
  • E if T is an unsigned integer;
  • otherwise, std​::​abs(E) if T is an arithmetic type,
  • otherwise, abs(E), if that expression is valid, with overload resolution performed in a context that includes the declaration template<class T> T abs(T) = delete;
    If the function selected by overload resolution does not return the absolute value of its input, the program is ill-formed, no diagnostic required.