[phobos] is*Range + Qualified Types

David Simcha dsimcha at gmail.com
Wed Aug 11 20:04:04 PDT 2010


I'm looking to go on a major debugging spree and make std.range work 
with const ranges.  For example, the following should work:

import std.range, std.algorithm;

void main() {
     const foo = map!"a ^^ 2"([1,2,3,4,5]);
     auto myRetro = retro(foo);
}

Right now, I don't even get to the point of instantiating retro because 
I get the following encrypted Klingon related to its constraints:

test9.d(5): Error: template std.range.retro(R) if 
(isBidirectionalRange!(R)) does not match any function template declaration
test9.d(5): Error: template std.range.retro(R) if 
(isBidirectionalRange!(R)) cannot deduce template function from argument 
types !()(const(Map!(result,int[])))

This error occurs because front(), popFront(), et al. aren't callable on 
const(Map) objects.  This is pretty much a blocker for fixing the deeper 
issues.  Does it sound reasonable to everyone that is*Range, where * is 
forward, bidirectional, etc. should operate on the shallowly Unqual'd 
version of the type, or is there some good reason I'm missing why this 
shouldn't be the case?


More information about the phobos mailing list