Mercurial > repos > public > sbplib_julia
changeset 725:e5b51c82f83b feature/static_dict
Docstring for pair type functions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 17 Mar 2021 20:16:20 +0100 |
parents | a789e789e30f |
children | 103f61d09a8b |
files | src/StaticDicts/StaticDicts.jl |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/StaticDicts/StaticDicts.jl Wed Mar 17 20:15:02 2021 +0100 +++ b/src/StaticDicts/StaticDicts.jl Wed Mar 17 20:16:20 2021 +0100 @@ -44,9 +44,6 @@ return default end -firsttype(::Pair{T1,T2}) where {T1,T2} = T1 -secondtype(::Pair{T1,T2}) where {T1,T2} = T2 - Base.iterate(d::StaticDict) = iterate(d.pairs) Base.iterate(d::StaticDict, state) = iterate(d.pairs,state) @@ -58,4 +55,19 @@ return StaticDict(d1.pairs..., d2.pairs...) end + +""" + firsttype(::Pair{T1,T2}) + +The type of the first element in the pair. +""" +firsttype(::Pair{T1,T2}) where {T1,T2} = T1 + +""" + secondtype(::Pair{T1,T2}) + +The type of the secondtype element in the pair. +""" +secondtype(::Pair{T1,T2}) where {T1,T2} = T2 + end # module