www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15358] New: std.range.each does not support opApply methods


          Issue ID: 15358
           Summary: std.range.each does not support opApply methods with
                    arbitrary arity
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: monkeyworks12 hotmail.com

The following code fails because lockstep with 3 arguments defines a trinary
opApply, but each only supports up to binary opApply, with one argument being
an index:

void main(){
  import std.container;
  import std.stdio;
  import std.algorithm.iteration;
  import std.range;

  Array!int ai = [1,2,3,4];
  Array!int ai1 = [1,2,3,4];
  Array!int ai2 = [1,2,3,4];

  auto arange2 = lockstep(ai[],ai1[],ai2[]);

  //Error: template std.algorithm.iteration.each cannot deduce function from
  //argument types !((a, b, c) => writeln(a, b, c))(Lockstep!(RangeT!
  //(Array!int), RangeT!(Array!int), RangeT!(Array!int))), 
  //candidates are:
  //    /opt/compilers/dmd2/include/std/algorithm/iteration.d(820):
  //        std.algorithm.iteration.each(alias pred = "a")
  //arange2.each!((a,b,c) => writeln(a, b, c));


Nov 18 2015