I've been having trouble propagating range traits for
range-wrapper structs.
Consider this sample code:
struct Wrapper (R)
{
R range;
static if (isInputRange!R)
{
/* input range stuff */
}
static if (isForwardRange!R)
{
auto save () inout
{
return this;
}
static assert (isForwardRange!Wrapper); // <-- this fails
}
}
making save @property makes it compile.
So I looked at the implementation of isForwardRange and now I am
very confused about this condition:
is(typeof((inout int = 0)
{
R r1 = void;
static assert (is(typeof(r1.save) == R));
}));
What's the rationale behind stating the condition this way as
opposed to, say,
is (typeof(R.init.save)) == R) || is ((typeof(R.init.save()) == R)
so that member fields as well as @property and non-@property
methods will match, and what is the purpose of (inout int = 0)?