Repeat

struct Repeat<T>

A collection whose elements are all identical Ts.

Inheritance CollectionType, SequenceType, _CollectionType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Index = Int

A type that represents a valid position in the collection.

Valid indices consist of the position of every element and a "past the end" position that's not valid for use as a subscript.

Generator = IndexingGenerator<Repeat<T>>

Type alias inferred.

Element = T

Type alias inferred.

Index = Int

Type alias inferred.

SubSequence = Slice<Repeat<T>>

Type alias inferred.

Import import Swift

Initializers

init(count:repeatedValue:)

Construct an instance that contains count elements having the value repeatedValue.

Declaration

init(count: Int, repeatedValue: T)

Instance Variables

var count: Int

The number of elements in this collection.

Declaration

var count: Int { get set }
var endIndex: Index

Always equal to count, which is one greater than the index of the last element in a non-empty instance.

Declaration

var endIndex: Index { get }
var repeatedValue: T

The value of every element in this collection.

Declaration

var repeatedValue: T { get }
var startIndex: Index

Always zero, which is the index of the first element in a non-empty instance.

Declaration

var startIndex: Index { get }

Subscripts

subscript(_: Int)

Declaration

subscript(position: Int) -> T { get }

Instance Methods

func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)

Declaration

func generate() -> IndexingGenerator<Repeat<T>>