From slices to perfect imitators: opByValue
luka8088 via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 7 21:37:16 PDT 2014
On 8.5.2014. 5:58, Andrei Alexandrescu wrote:
>
> This magic of T[] is something that custom ranges can't avail themselves
> of. In order to bring about parity, we'd need to introduce opByValue
> which (if present) would be automatically called whenever the object is
> passed by value into a function.
>
> This change would allow library designers to provide good solutions to
> making immutable and const ranges work properly - the way T[] works.
>
Looks very similar to some kind of opImplicitConvert.
http://forum.dlang.org/thread/teddgvbtmrxumffrhojh@forum.dlang.org
http://forum.dlang.org/thread/gq0fj7$4av$1@digitalmars.com
Maybe it would be better to have a more general solution instead of
special case solution, if there is no reason against implicit conversion
of course.
More information about the Digitalmars-d
mailing list