Files
swift-collections/Sources/TrailingElementsModule/TrailingElements.swift
T
Doug Gregor 2e7fb3e12a Add "trailing elements" module with facilities for tail-allocated storage
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.
2025-09-05 15:52:27 -07:00

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 }
}