https://github.com/tpapp/PushVectors.jl
workaround for julia#24909
https://github.com/tpapp/PushVectors.jl
Last synced: 3 months ago
JSON representation
workaround for julia#24909
- Host: GitHub
- URL: https://github.com/tpapp/PushVectors.jl
- Owner: tpapp
- License: other
- Created: 2019-04-29T10:19:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-20T09:18:05.000Z (over 4 years ago)
- Last Synced: 2025-03-26T20:56:19.271Z (3 months ago)
- Language: Julia
- Size: 17.6 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PushVectors

[](https://travis-ci.com/tpapp/PushVectors.jl)
[](http://codecov.io/github/tpapp/PushVectors.jl?branch=master)Implement a workaround for [julia#24909](https://github.com/JuliaLang/julia/issues/24909), using a [suggestion](https://github.com/JuliaLang/julia/issues/24909#issuecomment-419731925) 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
julia> v = PushVector{Int}()
0-element PushVector{Int64,Array{Int64,1}}julia> push!(v, 1)
1-element PushVector{Int64,Array{Int64,1}}:
1julia> finish!(v)
1-element Array{Int64,1}:
1
```