mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
Introduce new types `IntrusiveManagedBuffer` and `PaddedStorage` that consist of a fixed-sized header followed by variable-sized storage. The design of these types is inspired by the existing `ManagedBuffer` type in the standard library, but has been adjusted both to make them non-copyable and to eliminate the requirement for heap allocation.
11 lines
465 B
Swift
11 lines
465 B
Swift
/// Describes a type that has some number of elements following it directly
|
|
/// in memory. Such types are generally used with the `IntrusiveManagedBuffer`
|
|
/// type, which manages storage for the header and its trailing elements.
|
|
public protocol TrailingElements: ~Copyable {
|
|
/// The element type of the data that follows the header in memory.
|
|
associatedtype Element
|
|
|
|
/// The number of elements following the header.
|
|
var trailingCount: Int { get }
|
|
}
|