Mercurial > repos > public > sbplib_julia
changeset 739:e716602f1d62 feature/static_dict
Fix documentation and remove TBD
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 17 Mar 2021 21:56:55 +0100 |
parents | 0ed147a4068a |
children | e7e06bf394fb |
files | src/StaticDicts/StaticDicts.jl |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/StaticDicts/StaticDicts.jl Wed Mar 17 21:48:48 2021 +0100 +++ b/src/StaticDicts/StaticDicts.jl Wed Mar 17 21:56:55 2021 +0100 @@ -3,13 +3,13 @@ export StaticDict """ - StaticDict{K,V,N}(NTuple{N,Pair{K,V}}) <: AbstractDict + StaticDict{K,V,N} <: AbstractDict{K,V} A static dictionary implementing the interface for an `AbstractDict`. A `StaticDict` is fully immutable and after creation no changes can be made. -The immutable nature means that `StaticDict`s can be compared with `===`, in -constrast to regular `Dict`s or `ImmutableDict`s which can not. (See +The immutable nature means that `StaticDict` can be compared with `===`, in +constrast to regular `Dict` or `ImmutableDict` which can not. (See https://github.com/JuliaLang/julia/issues/4648 for details) One important aspect of this is that `StaticDict` can be used in a struct while still allowing the struct to be comared using the default implementation of `==` for @@ -41,7 +41,7 @@ StaticDict(pairs::NTuple{N,Pair} where N) = StaticDict(pairs...) function Base.get(d::StaticDict, key, default) - for p ∈ d.pairs # TBD: Is this the best? Should we use the iterator on `d`? + for p ∈ d.pairs if key == p.first return p.second end