Implicit conversions of head-const to tail-const ranges
Per Nordlöw
per.nordlow at gmail.com
Tue Mar 23 20:29:34 UTC 2021
On Tuesday, 23 March 2021 at 16:50:24 UTC, Per Nordlöw wrote:
> Has there been any attempts in dmd to generalize implicit
> conversions to allow implicit conversion of a head-const to
> tail-const range? Similar to what already happens for dynamic
> arrays (slices).
>
> Are there any apparent show-stoppers?
Do we want such a change to affect
@safe unittest
{
import std.algorithm.iteration : map;
import std.stdio;
auto x = [1, 2];
const y = x.map!(_ => _*_);
writeln(y);
}
currently printing
const(MapResult!(__lambda2, int[]))([1, 2])
to instead print
[1, 4]
?
I guess not.
More information about the Digitalmars-d
mailing list