www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18160] New: std.algorithm.iteration.each should be usable in

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

          Issue ID: 18160
           Summary: std.algorithm.iteration.each should be usable in  safe
                    code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

 safe unittest
{
    import std.algorithm.iteration : each;
    import std.range : lockstep;

    auto a = [ 1, 2, 3 ];
    auto b = [ 2, 3, 4 ];

    a.lockstep(b).each!((ref x, ref y) { ++x; ++y; });

    assert(a == [ 2, 3, 4 ]);
    assert(b == [ 3, 4, 5 ]);
}

--
Jan 02