//===----------------------------------------------------------------------===// // // This source file is part of the Swift Atomics open source project // // Copyright (c) 2020 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 // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// /// An atomic value that also supports atomic operations when wrapped /// in an `Optional`. Atomic optional wrappable types come with a /// standalone atomic representation for their optional-wrapped /// variants. public protocol AtomicOptionalWrappable: AtomicValue { /// The atomic storage representation for `Optional`. associatedtype AtomicOptionalRepresentation: AtomicStorage where AtomicOptionalRepresentation.Value == Self? } extension Optional: AtomicValue where Wrapped: AtomicOptionalWrappable { public typealias AtomicRepresentation = Wrapped.AtomicOptionalRepresentation }