comparison src/StaticDicts/StaticDicts.jl @ 735:3e0b0b44868e feature/static_dict

More docs
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 17 Mar 2021 21:29:37 +0100
parents 103f61d09a8b
children b5d9fbcdcef1
comparison
equal deleted inserted replaced
734:1a8ef927e732 735:3e0b0b44868e
6 StaticDict{K,V,N}(NTuple{N,Pair{K,V}}) <: AbstractDict 6 StaticDict{K,V,N}(NTuple{N,Pair{K,V}}) <: AbstractDict
7 7
8 A static dictionary implementing the interface for an `AbstractDict`. A 8 A static dictionary implementing the interface for an `AbstractDict`. A
9 `StaticDict` is fully immutable and after creation no changes can be made. 9 `StaticDict` is fully immutable and after creation no changes can be made.
10 10
11 The immutable nature means that `StaticDict`s can be compared with `==`, in 11 The immutable nature means that `StaticDict`s can be compared with `===`, in
12 constrast to regular `Dict`s or `ImmutableDict`s which can not. (See 12 constrast to regular `Dict`s or `ImmutableDict`s which can not. (See
13 https://github.com/JuliaLang/julia/issues/4648 for details) 13 https://github.com/JuliaLang/julia/issues/4648 for details) One important
14 aspect of this is that `StaticDict` can be used in a struct while still
15 allowing the struct to be comared using the default implementation of `==` for
16 structs.
14 17
15 Lookups are done by linear search. 18 Lookups are done by linear search.
16 19
17 Duplicate keys are not allowed and an error will be thrown if they are passed 20 Duplicate keys are not allowed and an error will be thrown if they are passed
18 to the constructor. 21 to the constructor.