Instance Property

underestimatedCount

A value less than or equal to the number of elements in the sequence, calculated nondestructively.

Declaration

var underestimatedCount: Int { get }
Available when Bound conforms to Strideable and Bound.Stride conforms to SignedInteger.

Discussion

The default implementation returns 0. If you provide your own implementation, make sure to compute the value nondestructively.

Complexity: O(1), except if the sequence also conforms to Collection. In this case, see the documentation of Collection.underestimatedCount.

See Also

Iterating Over a Range's Elements

func forEach((Bound) -> Void)

Calls the given closure on each element in the sequence in the same order as a for-in loop.

func enumerated() -> EnumeratedSequence<Range<Bound>>

Returns a sequence of pairs (n, x), where n represents a consecutive integer starting at zero and x represents an element of the sequence.

func makeIterator() -> IndexingIterator<Range<Bound>>

Returns an iterator over the elements of the collection.

var underestimatedCount: Int

A value less than or equal to the number of elements in the collection.