Escaping the Tyranny of the GC: std.rcstring, first blood

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 00:41:23 PDT 2014


On Monday, 15 September 2014 at 02:26:19 UTC, Andrei Alexandrescu 
wrote:
> So, please fire away. I'd appreciate it if you used RCString in 
> lieu of string and note the differences. The closer we get to 
> parity in semantics, the better.

It should support appending single code units:

---
alias String = RCString;

void main()
{
     String s = "abc";

     s ~= cast(char)'0';
     s ~= cast(wchar)'0';
     s ~= cast(dchar)'0';

     writeln(s); // abc000
}
---

Works with C[], fails with RCString. The same is true for 
concatenation.


More information about the Digitalmars-d mailing list