diff --git a/src/ordered_robin_dict.jl b/src/ordered_robin_dict.jl index e8b3b032..7ab0bf3e 100644 --- a/src/ordered_robin_dict.jl +++ b/src/ordered_robin_dict.jl @@ -430,18 +430,18 @@ function get_next_filled_index(h::OrderedRobinDict, index) return -1 end -Base.@propagate_inbounds function Base.iterate(h::OrderedRobinDict) +Base.@propagate_inbounds function Base.iterate(h::OrderedRobinDict{K,V}) where {K,V} isempty(h) && return nothing check_for_rehash(h) && rehash!(h) index = get_first_filled_index(h) - return (Pair(h.keys[index], h.vals[index]), index+1) + @inbounds return (Pair{K,V}(h.keys[index], h.vals[index]), index+1) end -Base.@propagate_inbounds function Base.iterate(h::OrderedRobinDict, i) +Base.@propagate_inbounds function Base.iterate(h::OrderedRobinDict{K,V}, i) where {K,V} length(h.keys) < i && return nothing index = get_next_filled_index(h, i) (index < 0) && return nothing - return (Pair(h.keys[index], h.vals[index]), index+1) + @inbounds return (Pair{K,V}(h.keys[index], h.vals[index]), index+1) end Base.filter!(f, d::Union{RobinDict, OrderedRobinDict}) = Base.filter_in_one_pass!(f, d) diff --git a/src/swiss_dict.jl b/src/swiss_dict.jl index 25be7c5c..16cdc114 100644 --- a/src/swiss_dict.jl +++ b/src/swiss_dict.jl @@ -636,11 +636,11 @@ function Base.delete!(h::SwissDict, key) return h end -Base.@propagate_inbounds function Base.iterate(h::SwissDict, state = h.idxfloor) +Base.@propagate_inbounds function Base.iterate(h::SwissDict{K,V}, state = h.idxfloor) where {K,V} is = _iterslots(h, state) is === nothing && return nothing i, s = is - @inbounds p = h.keys[i] => h.vals[i] + @inbounds p = Pair{K,V}(h.keys[i], h.vals[i]) return (p, s) end