Files
swift-collections/Sources/Future/Containers/BidirectionalContainer.swift
T
Karoy Lorentey 3d4c79a0a5 Overhaul Container protocols
- Container, MutableContainer: Replace iterator protocols with direct methods that return the next span following a particular index. This is a radical simplification, but it reintroduces some index validation during iteration, and may have undesirable overhead for complex container types.
- RigidArray, DynamicArray, NewArray: Update to reflect changes
- Span: Conform to RandomAccessContainer
- Borrow, Inout: Normalize labels of “owner” parameters. Expose pointers within the package.
- Shared: Normalize read() into borrow()
2025-04-17 00:40:27 -07:00

24 lines
876 B
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2024 - 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
@available(SwiftCompatibilitySpan 5.0, *)
public protocol BidirectionalContainer: Container, ~Copyable, ~Escapable {
override associatedtype Element: ~Copyable
func index(before i: Index) -> Index
func formIndex(before i: inout Index)
@_nonoverride func index(_ i: Index, offsetBy distance: Int) -> Index
@_nonoverride func formIndex(
_ i: inout Index, offsetBy distance: inout Int, limitedBy limit: Index
)
}