I noticed something funny when fixing this. In the template constraint for back(), is(typeof(A.init[0])), is used to check whether the type A supports indexing. This makes sense. In the constraint for front(), however, is(typeof(A[0])) is used. Does anyone know why this last case works at all? Outside of typeof(), A[0] is completely meaningless unless A is a tuple, so why allow this special case?
-Lars On Fri, 2010-11-05 at 08:12 -0400, dsource.org wrote: > phobos commit, revision 2123 > > > user: kyllingstad > > msg: > Bug 5163: meaningless error message with front() applied to void[] > > It's not possible to index into void[] arrays, which means that they > cannot be ranges. Therefore, I've added template constraints to > front(), back(), popFront(), and popBack() in std.array that prevents > them from being instantiated with void[]. > > http://www.dsource.org/projects/phobos/changeset/2123 > > _______________________________________________ > phobos mailing list > [email protected] > http://lists.puremagic.com/mailman/listinfo/phobos _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
