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/teddgvbtmrxumffrh...@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.