[Issue 15358] New: std.range.each does not support opApply methods with arbitrary arity

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Nov 18 10:30:45 PST 2015


https://issues.dlang.org/show_bug.cgi?id=15358

          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 at puremagic.com
          Reporter: monkeyworks12 at 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));
}

Related: 
https://issues.dlang.org/show_bug.cgi?id=4264
https://issues.dlang.org/show_bug.cgi?id=15357

--


More information about the Digitalmars-d-bugs mailing list