On Thursday, November 15, 2012 22:11:33 Timon Gehr wrote: > On 11/14/2012 08:32 PM, Jonathan M Davis wrote: > > On Wednesday, November 14, 2012 20:18:26 Timon Gehr wrote: > >> That is a very imprecise approximation. I think it does not cover any > >> ground: The day eg. 'array' will require this kind of non-transient > >> element range is the day where I will write my own. > > > > std.array.array _cannot_ work with a transient front. ... > > It can work if 'transient' is over-approximated like suggested in the > parent post.
How so? std.array.array _needs_ copies when it creates its array. If front is transient, it will end up with all elements being the same. So, either transient fronts need to be illegal, or std.array.array needs to be able to put a check for them in its template constraint to prevent them from being used with it. In either case, no range with a transient front would work with std.array.array. All that inferring transience from the type of front will do is make it so that std.array.array can prevent ranges with a transient front from compiling with it, and it would be forced to reject a bunch of ranges which were _not_ transient, because any mutable reference type would have to be treated as transient even if it wasn't. So, that doesn't make std.array.array work with ByLine or its ilk at all. - Jonathan M Davis