Type of string literal concatenated with non-immutable char array
Steven Schveighoffer
schveiguy at gmail.com
Mon Feb 1 16:37:09 UTC 2021
On 2/1/21 11:31 AM, Per Nordlöw wrote:
> On Monday, 1 February 2021 at 16:30:31 UTC, Per Nordlöw wrote:
>> Btw, does
>>
>> x ~ y ~ z ~ ...
>>
>> result in a single allocation?
>
> Provided all the operands has a `length` property.
As long as they are all arrays, yes, the compiler calls a single runtime
call to concatenate all of them.
For custom types, it's going to do them in order, 2 at a time.
-Steve
More information about the Digitalmars-d-learn
mailing list