Skip to content

Commit

Permalink
Use length argument in conversion to StdString
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Oct 2, 2023
1 parent ea07e0e commit b8db7be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/StdLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ Base.cmp(a::String, b::CppBasicString) = cmp(a,String(b))

# Make sure functions taking a C++ string as argument can also take a Julia string
CxxWrapCore.map_julia_arg_type(x::Type{<:StdString}) = AbstractString
StdLib.StdStringAllocated(x::String) = StdString(x)
Base.cconvert(::Type{CxxWrapCore.ConstCxxRef{StdString}}, x::String) = StdString(x)
Base.cconvert(::Type{StdLib.StdStringDereferenced}, x::String) = StdString(x)
StdLib.StdStringAllocated(x::String) = StdString(x,length(x))
Base.cconvert(::Type{CxxWrapCore.ConstCxxRef{StdString}}, x::String) = StdString(x,length(x))
Base.cconvert(::Type{StdLib.StdStringDereferenced}, x::String) = StdString(x,length(x))
Base.unsafe_convert(::Type{CxxWrapCore.ConstCxxRef{StdString}}, x::StdString) = ConstCxxRef(x)

function StdValArray(v::Vector{T}) where {T}
Expand Down

0 comments on commit b8db7be

Please sign in to comment.