Implicit conversion of unique chars[] to string

ag0aep6g anonymous at example.com
Mon Mar 22 21:58:43 UTC 2021


On 22.03.21 21:38, Per Nordlöw wrote:
> Am I the only one being annoyed by the fact that
> 
>      chainPath(...).array
> 
> doesn't implicit convert to string despite the array returned from 
> .array is allocated by the GC.

Works for me:

----
import std.array: array;
import std.path: chainPath;
void main()
{
     string chained = chainPath("foo", "bar").array;
}
----

Uniqueness is being inferred based on purity. If it doesn't work for 
you, then you're probably doing something impure.


More information about the Digitalmars-d-learn mailing list