commonLength
Tobias Pankrath via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 15 05:59:03 PST 2015
> I just discovered that zip has StoppingPolicy so why does
>
> auto commonPrefixLength(R...)(R ranges) if (ranges.length == 2)
> {
> import std.range: zip;
> return zip!((a, b) => a[0] != b[1])(ranges);
> }
>
> unittest
> {
> assert(commonPrefixLength([1, 2, 3, 10],
> [1, 2, 4, 10]) == 2);
> }
>
StoppingPolicy is not a template parameter, it is this one:
http://dlang.org/phobos/std_range.html#.StoppingPolicy
More information about the Digitalmars-d-learn
mailing list