Expressing range constraints in CNF form

Sebastiaan Koppe via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 11 13:32:09 PDT 2017


On Sunday, 11 June 2017 at 00:28:58 UTC, Andrei Alexandrescu 
wrote:
> // Also possible (no change to the language)
> enum bool isInputRange(R) =
>     is(typeof((ref R r) => r)) && msg("must be copyable")
>     && is(ReturnType!((R r) => r.empty) == bool) && msg("must 
> support bool empty")
>     && is(typeof(lvalueOf!R.front)) && msg("must support front")
>     && is(typeof(lvalueOf!R.popFront)) && msg("must support 
> back");
>
>
> Andrei

What about using ddoc?

enum bool isInputRange(R) =
     is(typeof((ref R r) => r)) /// must be copyable
     && is(ReturnType!((R r) => r.empty) == bool) /// must support 
bool empty
     && is(typeof(lvalueOf!R.front)) /// must support front
     && is(typeof(lvalueOf!R.popFront)) /// must support back


More information about the Digitalmars-d mailing list