Building a string from n chars
    "Nordlöw" via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Sep  4 12:22:41 PDT 2014
    
    
  
On Wednesday, 3 September 2014 at 20:20:09 UTC, Meta wrote:
> Does this work?
>
> s ~= "*".replicate(n);
Yes, thanks.
So what's best?
     type ~= '*'.repeat(pointerCount).array;
or
     type ~= "*".replicate(pointerCount);
?
Further, -vgc says only ~= will allocate:
t_repeat_replicate.d(12,19): vgc: operator ~= may cause GC 
allocation
t_repeat_replicate.d(13,19): vgc: operator ~= may cause GC 
allocation
Is DMD/Phobos already that clever!?
:=)
    
    
More information about the Digitalmars-d-learn
mailing list