Implicit conversions of head-const to tail-const ranges

Simen Kjærås simen.kjaras at gmail.com
Thu Mar 25 13:23:30 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?

I presented a method that would be mostly drop-in on the blog 
last year:

https://dlang.org/blog/2020/06/25/a-pattern-for-head-mutable-structures/

It would require some (additive) changes to Phobos to be useful, 
and was intended as a DIP until I was informed there was a plan 
for these conversions. I believe any solution would look similar 
to my solution, but there could be other options. Maybe I should 
look into the DIP route again.

--
   Simen


More information about the Digitalmars-d mailing list