Does to!(string)(char[]) do any memory allocation on conversion?
aliak
something at something.com
Mon Dec 25 15:00:19 UTC 2017
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
> Does to!(string)(char[]) do any memory allocation on conversion
> or is this similar to a cast or what else?
As said it calls idup, which calls _trustedDup which seems to
call _dup which does memory allocation ->
https://github.com/dlang/druntime/blob/v2.077.1/src/object.d#L3863
I think you can use assumeUnique to avoid allocs though. See code
gen here:
https://godbolt.org/g/44pLpL
More information about the Digitalmars-d-learn
mailing list