-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing push! implementation #21
Comments
Here is what I did: Add the following methods in Base.resize!(A::CircularVector, nl::Integer) = (resize!(parent(A), nl); A)
Base.push!(a::CircularVector, x...) = (push!(parent(a), x...); a)
Base.pop!(a::CircularVector) = pop!(parent(a))
Base.append!(a::CircularVector, items) = (append!(parent(a), items); a)
Base.empty!(a::CircularVector) = (empty!(parent(a)); a) Now we have julia> using CircularArrays
julia> c = CircularVector([1,2,3])
3-element CircularVector(::Vector{Int64}):
1
2
3
julia> push!(c, 4)
4-element CircularVector(::Vector{Int64}):
1
2
3
4
julia> c
4-element CircularVector(::Vector{Int64}):
1
2
3
4
julia> push!(c, 6,7,8)
7-element CircularVector(::Vector{Int64}):
1
2
3
4
6
7
8 |
Thank you @terasakisatoshi! @Vexatos is this a valid approach to be merged as a PR? |
Since I already have |
@terasakisatoshi it would be nice to convert your comment to a PR 💯 |
I found that when |
This is now available in Version 1.4.0. |
The text was updated successfully, but these errors were encountered: