From e3fa7b6dbc8e4d515e97adb14c41048e5e3b028c Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Mon, 10 Jul 2023 22:57:21 -0400 Subject: [PATCH] Permit non-number types in Accumulator (#860) --- src/accumulator.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/accumulator.jl b/src/accumulator.jl index 7050f7866..19065d52c 100644 --- a/src/accumulator.jl +++ b/src/accumulator.jl @@ -1,18 +1,18 @@ #A counter type """ - Accumulator{T, V<:Number} + Accumulator{T, V} A accumulator is a data structure that maintains an accumulated total for each key. The particular case where those totals are integers is a counter. """ -struct Accumulator{T, V <: Number} <: AbstractDict{T, V} +struct Accumulator{T, V} <: AbstractDict{T, V} map::Dict{T, V} end ## constructors -Accumulator{T, V}() where {T, V <: Number} = Accumulator{T, V}(Dict{T, V}()) +Accumulator{T, V}() where {T, V} = Accumulator{T, V}(Dict{T, V}()) Accumulator(map::AbstractDict) = Accumulator(Dict(map)) Accumulator(ps::Pair...) = Accumulator(Dict(ps))