On Sunday, 26 March 2017 at 23:25:49 UTC, XavierAP wrote:
I've looked into Phobos to emulate it when defining my own trait template, and when I see this:

module std.range.primitives;
// ...
template isInputRange(R)
{
    enum bool isInputRange = is(typeof(
    (inout int = 0)
    {
        R r = 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
    }));

I wonder, why that unused parameter (inout int = 0)?
In my project () { /* ... */ } works the same for a custom trait.

Even Andrei was baffled:

http://forum.dlang.org/thread/nepm2k$311l$1...@digitalmars.com

Reply via email to