-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d2e158
commit 89d2c86
Showing
12 changed files
with
269 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using .StdLib: StdDeque | ||
|
||
Base.IndexStyle(::Type{<:StdDeque}) = IndexLinear() | ||
Base.size(v::StdDeque) = (Int(cppsize(v)),) | ||
Base.getindex(v::StdDeque, i::Int) = cxxgetindex(v, i)[] | ||
Base.setindex!(v::StdDeque{T}, val, i::Int) where {T} = cxxsetindex!(v, convert(T, val), i) | ||
Base.push!(v::StdDeque, x) = push_back!(v, x) | ||
Base.pushfirst!(v::StdDeque, x) = push_front!(v, x) | ||
Base.pop!(v::StdDeque) = pop_back!(v) | ||
Base.popfirst!(v::StdDeque) = pop_front!(v) | ||
Base.resize!(v::StdDeque, n::Integer) = resize!(v, n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using .StdLib: StdForwardList | ||
|
||
Base.isempty(v::StdForwardList) = flist_isempty(v) | ||
Base.first(v::StdForwardList) = flist_front(v) | ||
Base.empty!(v::StdForwardList) = (flist_empty!(v); v) | ||
Base.pushfirst!(v::StdForwardList, x) = (flist_push_front!(v, x); v) | ||
Base.popfirst!(v::StdForwardList) = (flist_pop_front!(v); v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using .StdLib: StdList | ||
|
||
Base.size(v::StdList) = (Int(cppsize(v)),) | ||
Base.length(v::StdList) = Int(cppsize(v)) | ||
Base.isempty(v::StdList) = list_isempty(v) | ||
Base.first(v::StdList) = list_front(v) | ||
Base.last(v::StdList) = list_back(v) | ||
Base.empty!(v::StdList) = (list_empty!(v); v) | ||
Base.push!(v::StdList, x) = (list_push_back!(v, x); v) | ||
Base.pushfirst!(v::StdList, x) = (list_push_front!(v, x); v) | ||
Base.pop!(v::StdList) = (list_pop_back!(v); v) | ||
Base.popfirst!(v::StdList) = (list_pop_front!(v); v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using .StdLib: StdMultiset, StdUnorderedMultiset | ||
|
||
for StdMultisetType in (StdMultiset, StdUnorderedMultiset) | ||
Base.size(v::StdMultisetType) = (Int(cppsize(v)),) | ||
Base.length(v::StdMultisetType) = Int(cppsize(v)) | ||
Base.isempty(v::StdMultisetType) = multiset_isempty(v) | ||
Base.empty!(v::StdMultisetType) = (multiset_empty!(v); v) | ||
Base.push!(v::StdMultisetType, x) = (multiset_insert!(v, x); v) | ||
Base.in(x, v::StdMultisetType) = multiset_in(v, x) | ||
Base.delete!(v::StdMultisetType, x) = (multiset_delete!(v, x); v) | ||
Base.count(x, v::StdMultisetType) = multiset_count(v, x) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using .StdLib: StdPriorityQueue | ||
|
||
Base.size(v::StdPriorityQueue) = (Int(cppsize(v)),) | ||
Base.length(v::StdPriorityQueue) = Int(cppsize(v)) | ||
Base.isempty(v::StdPriorityQueue) = pq_isempty(v) | ||
Base.first(v::StdPriorityQueue) = isempty(v) ? nothing : pq_top(v) | ||
Base.push!(v::StdPriorityQueue, x) = (pq_push!(v, x); v) | ||
function Base.pop!(v::StdPriorityQueue) | ||
isempty(v) && throw(ArgumentError("Cannot pop from an empty priority queue")) | ||
val = pq_top(v) | ||
pq_pop!(v) | ||
return val | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using .StdLib: StdQueue | ||
|
||
Base.size(v::StdQueue) = (Int(cppsize(v)),) | ||
Base.length(v::StdQueue) = Int(cppsize(v)) | ||
Base.isempty(v::StdQueue) = q_empty(v) | ||
Base.push!(v::StdQueue, x) = (push_back!(v, x); v) | ||
Base.first(v::StdQueue) = front(v) | ||
Base.pop!(v::StdQueue) = (pop_front!(v); v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using .StdLib: StdSet, StdUnorderedSet | ||
|
||
for StdSetType in (StdSet, StdUnorderedSet) | ||
Base.size(v::StdSetType) = (Int(cppsize(v)),) | ||
Base.length(v::StdSetType) = Int(cppsize(v)) | ||
Base.isempty(v::StdSetType) = set_isempty(v) | ||
Base.empty!(v::StdSetType) = (set_empty!(v); v) | ||
Base.push!(v::StdSetType, x) = (set_insert!(v, x); v) | ||
Base.in(x, v::StdSetType) = set_in(v, x) | ||
Base.delete!(v::StdSetType, x) = (set_delete!(v, x); v) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using .StdLib: StdStack | ||
|
||
Base.size(v::StdStack) = (Int(cppsize(v)),) | ||
Base.length(v::StdStack) = Int(cppsize(v)) | ||
Base.isempty(v::StdStack) = stack_isempty(v) | ||
Base.push!(v::StdStack, x) = (stack_push!(v, x); v) | ||
Base.first(v::StdStack) = stack_top(v) | ||
Base.pop!(v::StdStack) = (stack_pop!(v); v) |
Oops, something went wrong.