Operator: +=

  • operator += {
  •                  associativity right
  •                  precedence
  •                  assignment
  •                  }

Declarations

func +=(_: inout Double, rhs: Double)

Declaration

func +=(_: inout Float, rhs: Float)

Declaration

func +=(_: inout Float80, rhs: Float80)

Declaration

func +=(_: inout Int, rhs: Int)

Declaration

  • func +=(lhs: inout Int, rhs: Int)
func +=(_: inout Int8, rhs: Int8)

Declaration

func +=(_: inout Int16, rhs: Int16)

Declaration

func +=(_: inout Int32, rhs: Int32)

Declaration

func +=(_: inout Int64, rhs: Int64)

Declaration

func +=(_: inout UInt, rhs: UInt)

Declaration

func +=(_: inout UInt8, rhs: UInt8)

Declaration

func +=(_: inout UInt16, rhs: UInt16)

Declaration

func +=(_: inout UInt32, rhs: UInt32)

Declaration

func +=(_: inout UInt64, rhs: UInt64)

Declaration

func += <C : Collection>(_: inout [C.Iterator.Element], rhs: C)

Appends the elements of a collection to an array.

Use this operator to append the elements of a collection to the end of an array with same Element type. This example appends the elements of a Range<Int> instance to an array of integers.

  • var numbers = [1, 2, 3, 4, 5]
  • numbers += 10...15
  • print(numbers)
  • // Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"

Parameters: lhs: The array to append to. rhs: A collection.

Complexity: O(n), where n is the length of the resulting array.

Declaration

  • func +=<C : Collection>(lhs: inout [C.Iterator.Element], rhs: C)
func += <C : Collection>(_: inout ArraySlice<C.Iterator.Element>, rhs: C)

Appends the elements of a collection to an ArraySlice instance.

Use this operator to append the elements of a collection to the end of an ArraySlice instance with same Element type. This example appends the elements of a Range<Int> instance to an array of integers.

  • var numbers = [1, 2, 3, 4, 5]
  • numbers += 10...15
  • print(numbers)
  • // Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"

Parameters: lhs: The array to append to. rhs: A collection.

Complexity: O(n), where n is the length of the resulting array.

Declaration

func += <C : Collection>(_: inout ContiguousArray<C.Iterator.Element>, rhs: C)

Appends the elements of a collection to a ContiguousArray instance.

Use this operator to append the elements of a collection to the end of a ContiguousArray instance with same Element type. This example appends the elements of a Range<Int> instance to an array of integers.

  • var numbers = [1, 2, 3, 4, 5]
  • numbers += 10...15
  • print(numbers)
  • // Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"

Parameters: lhs: The array to append to. rhs: A collection.

Complexity: O(n), where n is the length of the resulting array.

Declaration

func += <Element, C : Collection where C.Iterator.Element == Element>(_: inout _ContiguousArrayBuffer<Element>, rhs: C)

Append the elements of rhs to lhs.

Declaration

  • func +=<Element, C : Collection where C.Iterator.Element == Element>(lhs: inout _ContiguousArrayBuffer<Element>, rhs: C)
func += <Pointee>(_: inout UnsafeMutablePointer<Pointee>, rhs: Int)

Declaration

func += <Pointee>(_: inout UnsafePointer<Pointee>, rhs: Int)

Declaration

func += <S : Sequence>(_: inout [S.Iterator.Element], rhs: S)

Appends the elements of a sequence to an array.

Use this operator to append the elements of a sequence to the end of an array with same Element type. This example appends the elements of a Range<Int> instance to an array of integers.

  • var numbers = [1, 2, 3, 4, 5]
  • numbers += 10...15
  • print(numbers)
  • // Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"

Parameters: lhs: The array to append to. rhs: A collection or finite sequence.

Complexity: O(n), where n is the length of the resulting array.

Declaration

  • func +=<S : Sequence>(lhs: inout [S.Iterator.Element], rhs: S)
func += <S : Sequence>(_: inout ArraySlice<S.Iterator.Element>, rhs: S)

Appends the elements of a sequence to an ArraySlice instance.

Use this operator to append the elements of a sequence to the end of an ArraySlice instance with same Element type. This example appends the elements of a Range<Int> instance to an array of integers.

  • var numbers = [1, 2, 3, 4, 5]
  • numbers += 10...15
  • print(numbers)
  • // Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"

Parameters: lhs: The array to append to. rhs: A collection or finite sequence.

Complexity: O(n), where n is the length of the resulting array.

Declaration

func += <S : Sequence>(_: inout ContiguousArray<S.Iterator.Element>, rhs: S)

Appends the elements of a sequence to a ContiguousArray instance.

Use this operator to append the elements of a sequence to the end of a ContiguousArray instance with same Element type. This example appends the elements of a Range<Int> instance to an array of integers.

  • var numbers = [1, 2, 3, 4, 5]
  • numbers += 10...15
  • print(numbers)
  • // Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"

Parameters: lhs: The array to append to. rhs: A collection or finite sequence.

Complexity: O(n), where n is the length of the resulting array.

Declaration

func += <T : _IntegerArithmetic>(_: inout T, rhs: T)

Adds lhs and rhs and stores the result in lhs, trapping in case of arithmetic overflow (except in -Ounchecked builds).

Declaration

func += <T : FloatingPoint>(_: inout T, rhs: T)

Declaration

func += <T : Strideable>(_: inout T, rhs: T.Stride)

Declaration

  • func +=<T : Strideable>(lhs: inout T, rhs: T.Stride)