Negatable

public protocol Negatable : AdditiveArithmetic

A type that can be additively inverted.

Note

Unlike SignedNumber, Negatable types do not need to conform to Comparable, allowing conformance by two‐dimensional vectors, etc.

Conformance Requirements:

  • −(_:) Default implementation

    Returns the additive inverse of the operand.

    Mutating variant

    −=

    Default Implementation

    Returns the additive inverse of the operand.

    Mutating variant

    −=

    Declaration

    Swift

    static prefix func  (operand: Self) -> Self

    Parameters

    operand

    The value to invert.

  • −=(_:) Default implementation

    Sets the operand to its additive inverse.

    Nonmutating variant

    Default Implementation

    Sets the operand to its additive inverse.

    Nonmutating variant

    Declaration

    Swift

    static postfix func = (operand: inout Self)

    Parameters

    operand

    The value to modify by inversion.