Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ordered_robin_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/swiss_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading