Operator: +=

operator += { associativity right precedence assignment }

Declarations

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

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

Declaration

func +=(lhs: inout UInt64, rhs: UInt64)
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>(lhs: inout ArraySlice<C.Iterator.Element>, rhs: C)
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 +=<C : Collection>(lhs: inout ContiguousArray<C.Iterator.Element>, rhs: C)
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>(lhs: inout UnsafeMutablePointer<Pointee>, rhs: Int)
func += <Pointee>(_: inout UnsafePointer<Pointee>, rhs: Int)

Declaration

func +=<Pointee>(lhs: inout UnsafePointer<Pointee>, rhs: Int)
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>(lhs: inout ArraySlice<S.Iterator.Element>, rhs: S)
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 +=<S : Sequence>(lhs: inout ContiguousArray<S.Iterator.Element>, rhs: S)
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 : _IntegerArithmetic>(lhs: inout T, rhs: T)
func += <T : FloatingPoint>(_: inout T, rhs: T)

Declaration

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

Declaration

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

Declaration

func +=<T : UnsignedInteger>(lhs: inout T, rhs: T._DisallowMixedSignArithmetic)