Mercurial > repos > public > sbplib_julia
changeset 724:a789e789e30f feature/static_dict
Docstring for StaticDict
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 17 Mar 2021 20:15:02 +0100 |
parents | b2af21a4b376 |
children | e5b51c82f83b |
files | src/StaticDicts/StaticDicts.jl |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/StaticDicts/StaticDicts.jl Tue Mar 16 22:37:10 2021 +0100 +++ b/src/StaticDicts/StaticDicts.jl Wed Mar 17 20:15:02 2021 +0100 @@ -2,17 +2,17 @@ export StaticDict -# Vidar 2021-02-27 -#NOTE: This type was added since ==-comparison of structs containing -# Dict (even Base.ImmutableDict) fails even though the fields satisfy -# ==-comparison. This is due to the fact that === is called for Dict-fields. -# See https://github.com/JuliaLang/julia/issues/4648. If the PR gets resolved -# we should consider removing StaticDict. """ - StaticDict{K,V,N}(NTuple{N,Pair{K,V}}) + StaticDict{K,V,N}(NTuple{N,Pair{K,V}}) <: AbstractDict + +A static dictionary implementing the interface for an `AbstractDict`. A +`StaticDict` is fully immutable and after creation no changes can be made. -A simple static dictonary. Performs lookup using linear search with ==-comparison -of keys. No hashing is used. +The immutable nature means that `StaticDict`s can be compared with `==`, in +constrast to regular `Dict`s or `ImmutableDict`s which can not. (See +https://github.com/JuliaLang/julia/issues/4648 for details) + +Lookups are done by linear search. """ struct StaticDict{K,V,N} <: AbstractDict{K,V} pairs::NTuple{N,Pair{K,V}}