RCString

Refrence counting string

struct RCString {
RCArray!(immutable char) payload;
}

Alias This

toString

Examples

1 void f(string) {}
2 RCString r;
3 {
4     auto s1 = "hello, world";
5 
6     // assign (copy)
7     r = s1;
8     assert(&r[0] != &s1[0]);
9 
10     // able to copy mutable string
11     char[100] s;
12     s[0 .. s1.length] = s1;
13     r = s;
14     r = RCString(s[0 .. s1.length]);
15 }
16 assert(r == "hello, world");

Meta