Skip to content
Basic implementation of a generic stack type that uses copy-on-write
Swift
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.swiftpm/xcode/package.xcworkspace
Sources
Tests
.gitignore
.swift-version
.swiftformat
Package.swift
README.md

README.md

COW-Stack

This SPM package contains a very basic implementation of a generic Stack<Element> type that has value semantics and uses copy-on-write (COW) to improve its performance. Therefore, it works similarly to the collection types from Swift's standard library (e.g., Array<Element>, Set<Element>, String).

There is an accompanying blog post for this repository: https://tonisuter.com/blog/2020/01/understanding-copy-on-write-value-types-swift/

Caution:

This repository was only created to demonstrate Swift's copy-on-write mechanism with an example. It has various limitations and is not supposed to be used in production. If you ever want or need to create a Stack type you should probably just wrap a regular Swift array (or use the array directly).

You can’t perform that action at this time.