Files
swift-collections/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift
T
2025-10-23 15:05:12 -07:00

30 lines
847 B
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 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
//
//===----------------------------------------------------------------------===//
#if !COLLECTIONS_SINGLE_MODULE
import InternalCollectionsUtilities
import ContainersPreview
#endif
#if compiler(>=6.2)
@available(SwiftStdlib 5.0, *)
extension UniqueDeque where Element: ~Copyable {
@_alwaysEmitIntoClient
@_transparent
public mutating func insert(_ newElement: consuming Element, at index: Int) {
_ensureFreeCapacity(1)
_storage.insert(newElement, at: index)
}
}
#endif