Hello,
is there a pretty way to split a range into 3 pieces, like findSplit, just with a predicate instead of comparing it with an element.

Like this :

void main() {
    import std.algorithm, std.stdio;

    auto list = [1,2,3,4,5,6,7];
    writeln(findSplit!(x => x == 3 )(list));
    //should print Tuple!(....) ([1,2], [3], [4,5,6,7])
}

findSplit accepts a predicate but it doesnt compile for me if i use an other function than ((a,b) => a == b).
  • findSplit Gecko via Digitalmars-d-learn

Reply via email to