std.array.array for immutable data types

Seb seb at wilzba.ch
Mon Feb 19 07:22:59 UTC 2018


On Monday, 19 February 2018 at 07:08:49 UTC, Fra Mecca wrote:
> Is there a way to avoid using to! conversion here?
>
> immutable string[] dst = to!(immutable 
> string[])(array(pipe.readEnd.byLineCopy));

Are you looking for something like assumeUnique [1]?

```
pipe.readEnd.byLineCopy.array.assumeUnique;
```

It's just a nice wrapper for cast(immutable string[]).


[1] https://dlang.org/phobos/std_exception.html#assumeUnique


More information about the Digitalmars-d-learn mailing list