[phobos] is*Range + Qualified Types
Steve Schveighoffer
schveiguy at yahoo.com
Fri Sep 17 10:56:35 PDT 2010
----- Original Message ----
> From: David Simcha <dsimcha at gmail.com>
>
> On 9/17/2010 3:08 AM, Andrei Alexandrescu wrote:
> >
> > I'm not sure how generalizable this is, but it's a start. There is also the
>remaining nagging issue of duplicating the line
> >
> > return typeof(return)(root);
> >
> > which in other cases might expand to more lines.
>
> Shouldn't inout solve this once it's fully implemented? Or maybe template
>this parameters + auto return types?
inout inside templates isn't really supported. I'm not sure how it should
work. I know that inout is not supposed to be valid on a member variable
because how does this work?
struct S
{
inout int x; // what does this mean?
}
So how would this work?
struct S(T)
{
T x;
}
S!(inout int) s;
The crux of this whole problem is that implicit conversions that make sense to a
person are illegal to the compiler. For example, it would make sense to a
person that you could convert a Range!(N) into a Range!(const N), but the
compiler sees them as distinct types. I don't know the right answer of how to
fix this except to revisit trying to define tail-const.
-Steve
More information about the phobos
mailing list