Operator: +

operator + { associativity left precedence }

Declarations

func +(_: Double, rhs: Double)

Declaration

func +(lhs: Double, rhs: Double) -> Double
func +(_: Float, rhs: Float)

Declaration

func +(lhs: Float, rhs: Float) -> Float
func +(_: Float80, rhs: Float80)

Declaration

func +(lhs: Float80, rhs: Float80) -> Float80
func +(_: Int, rhs: Int)

Declaration

func +(lhs: Int, rhs: Int) -> Int
func +(_: Int8, rhs: Int8)

Declaration

func +(lhs: Int8, rhs: Int8) -> Int8
func +(_: Int16, rhs: Int16)

Declaration

func +(lhs: Int16, rhs: Int16) -> Int16
func +(_: Int32, rhs: Int32)

Declaration

func +(lhs: Int32, rhs: Int32) -> Int32
func +(_: Int64, rhs: Int64)

Declaration

func +(lhs: Int64, rhs: Int64) -> Int64
func +(_: UInt, rhs: UInt)

Declaration

func +(lhs: UInt, rhs: UInt) -> UInt
func +(_: UInt8, rhs: UInt8)

Declaration

func +(lhs: UInt8, rhs: UInt8) -> UInt8
func +(_: UInt16, rhs: UInt16)

Declaration

func +(lhs: UInt16, rhs: UInt16) -> UInt16
func +(_: UInt32, rhs: UInt32)

Declaration

func +(lhs: UInt32, rhs: UInt32) -> UInt32
func +(_: UInt64, rhs: UInt64)

Declaration

func +(lhs: UInt64, rhs: UInt64) -> UInt64
func + <C, S where C : RangeReplaceableCollection, S : Sequence, S.Iterator.Element == C.Iterator.Element>(_: C, rhs: S)

Creates a new collection by concatenating the elements of a collection and a sequence.

The two arguments must have the same Element type. For example, you can concatenate the elements of an integer array and a Range<Int> instance.

let numbers = [1, 2, 3, 4]
let moreNumbers = numbers + 5...10
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: A collection or finite sequence.

Declaration

func +<C, S where C : RangeReplaceableCollection, S : Sequence, S.Iterator.Element == C.Iterator.Element>(lhs: C, rhs: S) -> C
func + <C, S where C : RangeReplaceableCollection, S : Sequence, S.Iterator.Element == C.Iterator.Element>(_: S, rhs: C)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<C, S where C : RangeReplaceableCollection, S : Sequence, S.Iterator.Element == C.Iterator.Element>(lhs: S, rhs: C) -> C
func + <RRC1, RRC2 where RRC1 : RangeReplaceableCollection, RRC2 : RangeReplaceableCollection, RRC2.Iterator.Element == RRC1.Iterator.Element>(_: RRC1, rhs: RRC2)

Creates a new collection by concatenating the elements of two collections.

The two arguments must have the same Element type. For example, you can concatenate the elements of two integer arrays.

let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: Another range-replaceable collection.

Declaration

func +<RRC1, RRC2 where RRC1 : RangeReplaceableCollection, RRC2 : RangeReplaceableCollection, RRC2.Iterator.Element == RRC1.Iterator.Element>(lhs: RRC1, rhs: RRC2) -> RRC1
func + <T where T : _IntegerArithmetic>(_: T, rhs: T)

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

Declaration

func +<T where T : _IntegerArithmetic>(lhs: T, rhs: T) -> T
func + <T where T : Arithmetic>(_: T, rhs: T)

Declaration

func +<T where T : Arithmetic>(lhs: T, rhs: T) -> T
func + <T where T : FloatingPoint>(_: T, rhs: T)

Declaration

func +<T where T : FloatingPoint>(lhs: T, rhs: T) -> T
func + <T where T : SignedInteger>(_: T, rhs: T.Stride)

Declaration

func +<T where T : SignedInteger>(lhs: T, rhs: T.Stride) -> T
func + <T where T : SignedInteger>(_: T.Stride, rhs: T)

Declaration

func +<T where T : SignedInteger>(lhs: T.Stride, rhs: T) -> T
func + <T where T : Strideable>(_: T, rhs: T.Stride)

Declaration

func +<T where T : Strideable>(lhs: T, rhs: T.Stride) -> T
func + <T where T : Strideable>(_: T.Stride, rhs: T)

Declaration

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

Declaration

func +<T where T : UnsignedInteger>(lhs: T, rhs: T._DisallowMixedSignArithmetic) -> T
func + <T where T : UnsignedInteger>(_: T._DisallowMixedSignArithmetic, rhs: T)

Declaration

func +<T where T : UnsignedInteger>(lhs: T._DisallowMixedSignArithmetic, rhs: T) -> T