AdditiveArithmetic

public protocol AdditiveArithmetic : Equatable, Subtractable

A value that can be added and subtracted.

Note

Unlike SignedNumber, AdditiveArithmetic types do not need to conform to Comparable, allowing conformance by two‐dimensional vectors, etc. For additional behaviour specific to one‐dimensional types, see NumericAdditiveArithmetic.

Conformance Requirements:

  • Equatable
  • Subtractable
  • ExpressibleByIntegerLiteral or static var additiveIdentity: Self { get }
  • additiveIdentity Default implementation

    The additive identity (origin).

    Default Implementation

    The additive identity (origin).

    Declaration

    Swift

    static var additiveIdentity: Self