Files
swift-mirror/stdlib/public/core/Slice.swift
Dmitri Hrybenko 8b2a1b4e1e stdlib: remove _CollectionSliceDefaultsType
The newest type checker improvements fix the underlying issue.

Swift SVN r27670
2015-04-24 02:42:08 +00:00

36 lines
1.1 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
public struct _prext_Slice<
UnderlyingCollection : _CollectionDefaultsType
> : CollectionType {
public typealias Index = UnderlyingCollection.Index
public typealias Element = UnderlyingCollection._Element
public let startIndex: Index
public let endIndex: Index
public subscript(index: Index) -> Element {
return _underlyingCollection[index]
}
internal init(_collection: UnderlyingCollection, bounds: Range<Index>) {
self._underlyingCollection = _collection
self.startIndex = bounds.startIndex
self.endIndex = bounds.endIndex
}
internal let _underlyingCollection: UnderlyingCollection
}