On Monday, 9 February 2015 at 10:56:31 UTC, Dicebot wrote:
Consider this trivial snippet:

```D
import std.array : join;

void main()
{
        auto s = join([ "aaa", "bbb", "ccc" ]);
        pragma(msg, typeof(s));
}
```

It outputs "string" which stands for immutable buffer.

The following works as well:
---
void main()
{
        import std.array : join;
        import std.stdio : writeln;

        char[] s = join(["foo", "bar"]);
        writeln(s); //foobar
}
---

std.array.join is strongly pure (with appropriate template arguments), so its return value is implicitly convertible to immutable.

Reply via email to