Skip to content

Commit

Permalink
Add method to Base.between to fix string indexing (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
barche authored Nov 16, 2023
1 parent a80510a commit bbddc3f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/StdLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Base.codeunit(s::StdString) = UInt8
Base.codeunit(s::StdWString) = Cwchar_t == Int32 ? UInt32 : UInt16
Base.codeunit(s::CppBasicString, i::Integer) = reinterpret(codeunit(s), cxxgetindex(s,i))
Base.isvalid(s::CppBasicString, i::Int) = checkbounds(Bool, s, i) && thisind(s, i) == i
@inline Base.between(b::T1, lo::T2, hi::T2) where {T1<:Integer,T2<:Integer} = (lo b) & (b hi)
Base.thisind(s::CppBasicString, i::Int) = Base._thisind_str(s, i)
Base.nextind(s::CppBasicString, i::Int) = Base._nextind_str(s, i)

Expand Down

0 comments on commit bbddc3f

Please sign in to comment.