PushVectors.jl

Workaround for julia#24909
Author tpapp
Popularity
9 Stars
Updated Last
2 Years Ago
Started In
April 2019

PushVectors

Lifecycle Build Status codecov.io

Implement a workaround for julia#24909, using a suggestion by @KristofferC (code used with permission, modified by @tpapp, who is responsible for all bugs etc).

Should I use this package?

Probably not, unless push! to Vector is the bottleneck in your code.

This is just a demonstration, and will be deprecated when the issue above is fixed.

Overview

The single exported type is PushVector, which can be push!ed to. Use finish! to shrink and obtain the final vector, but note that you should not use the original after that.

julia> v = PushVector{Int}()
0-element PushVector{Int64,Array{Int64,1}}

julia> push!(v, 1)
1-element PushVector{Int64,Array{Int64,1}}:
 1

julia> finish!(v)
1-element Array{Int64,1}:
 1