Second CT-Parameter of isRange Predicates

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 2 06:23:46 PST 2015


On Monday, 2 November 2015 at 14:16:53 UTC, Nordlöw wrote:
> Is there a reason why
>
>     isOutputRange(R,E)
>
> takes a second argument `E` but not other range predicates
>
>     isInputRange(R)
>     isForwardRange(R)
>     ...
>
> ?
>
> If so, I still think it would very be nice to have a second 
> argument `E` for all the other `isXRange` traits to simplify, 
> for instance,
>
>     if (isInputRange!R && is(int == ElementType!R))
>
> to simpler
>
>     if (isInputRange!(R, int))
>
> or even
>
>     if (isInputRange!R && is(isSomeChar!(ElementType!R)))
>
> to simpler
>
>     if (isInputRange!(R, isSomeChar))
>
> ?
>
> What do think?
>
> I'm planning to add a PR for this and simplify Phobos in all 
> places where this pattern is used.

https://github.com/D-Programming-Language/phobos/pull/3786

Atila


More information about the Digitalmars-d mailing list