Building a string from n chars
    "Nordlöw" via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Sep  4 13:38:37 PDT 2014
    
    
  
On Thursday, 4 September 2014 at 19:24:00 UTC, Nordlöw wrote:
>     string t1; t1 ~= '*'.repeat(n).array;
>     string t2; t2 ~= "*".replicate(n);
After having read 
http://dlang.org/phobos/std_array.html#.replicate
I came to the conclusion that the lazy std.range:repeat is 
preferred.
I'm still a bit confused about the fact that -vgc gives no 
warnings about GC-allocations, though.
    
    
More information about the Digitalmars-d-learn
mailing list