relative(to:)
Returns the range of indices described by this range expression within the given collection.
Declaration
func relative<C>(to collection: C) -> Range<Bound> where Bound == C.Index, C : CollectionParameters
- collection:
The collection to evaluate this range expression in relation to.
Return Value
A range suitable for slicing collection. The returned range is not guaranteed to be inside the bounds of collection. Callers should apply the same preconditions to the return value as they would to a range provided directly by the user.