1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-11-08 22:21:08 +00:00
ReCo.jl/src/PreVector.jl
2021-11-10 15:41:04 +01:00

19 lines
342 B
Julia

mutable struct PreVector{T}
last_ind::UInt64
v::Vector{T}
PreVector(T, N) = new{T}(UInt64(0), Vector{T}(undef, N))
end
function push!(pv::PreVector{T}, x::T) where {T}
pv.last_ind += 1
pv.v[pv.last_ind] = x
return nothing
end
function reset!(pv::PreVector{T}) where {T}
pv.last_ind = 0
return nothing
end