guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bytevector-string-ref


From: Taylan Kammer
Subject: Re: bytevector-string-ref
Date: Sun, 18 Dec 2022 17:25:16 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 18.12.2022 13:12, Sascha Ziemann wrote:
> I am wondering if something like bytevector-string-ref is missing in the API.
> Or is there any other way to extract a string from a byte vector, without
> copying the data twice?
> 

I don't think Guile currently has any way of giving you a string object that's
backed by the contents of a bytevector, instead of a privately held copy of 
those
bytevector contents.

AFAIK, there is only the utfX->string class of procedures, which give you a 
"newly
allocated" string from the bytevector's contents:

https://www.gnu.org/software/guile/manual/html_node/Bytevectors-as-Strings.html

That should only lead to the contents being copied once, however.  I'm not sure
why you asked "without copying the data twice."

-- 
Taylan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]