Skip to content

tonisuter/COW-Stack

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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).

About

Basic implementation of a generic stack type that uses copy-on-write

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages