D-Programming-Language/phobos — pull request #1491 by monarchdodra (2013-08-18 09:02:08+00:00)
Title: makes to! string to string `@safe`, `pure` and `CTFE`-able

This makes string to string operations with `to!` `@safe` and `pure` AND ctfe.

The old (default `toStr`) implementation is to use an `Appender` + `formattedWrite`, but in the case of string to string, the `formattedWrite` isn't actually needed. Bypassing the formattedWrite makes the operation `@safe` and `pure` and `ctfe`. It relies only on `Appender`, so is also *probably* faster to boot, but 0 attempts where made to verify this.

NOTE: The unittest was unchanged. I had to change the indentation with horribly breaks github's diff view:
```D
Before:
unittest
{
BODY;
}

after:
unittest
{
void dg()
{
BODY;
}
dg(); //checks runtime
assertCTFEable!dg; //checks compile time.
}