Named template constraints
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 22 08:06:34 PDT 2014
On Tue, 22 Apr 2014 10:58:41 -0400, Andrej Mitrovic via
Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
> On 4/22/14, Tim Holzschuh via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>> What does (inout int = 0) mean/affect here?
>
> This was asked recently, see my reponse here:
> http://forum.dlang.org/post/mailman.102.1396007039.25518.digitalmars-d-learn@puremagic.com
I think this can be fixed a different way:
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(R r)
{
R r2 = R.init; // can define a range object
if (r.empty) {} // can test for empty
r.popFront(); // can invoke popFront()
auto h = r.front; // can get the front of the range
}));
}
Note, is the r2 = R.init needed? Not sure.
-Steve
More information about the Digitalmars-d-learn
mailing list