[phobos] [dlang/phobos] ed03b2: Support multi-arg opApply/range for each.

GitHub via phobos phobos at puremagic.com
Tue May 10 07:13:52 PDT 2016


  Branch: refs/heads/master
  Home:   https://github.com/dlang/phobos
  Commit: ed03b22bc09046b274401d2ab4acfeb77147aa88
      https://github.com/dlang/phobos/commit/ed03b22bc09046b274401d2ab4acfeb77147aa88
  Author: Ryan Roden-Corrent <ryan at rcorre.net>
  Date:   2016-05-08 (Sun, 08 May 2016)

  Changed paths:
    M std/algorithm/iteration.d

  Log Message:
  -----------
  Support multi-arg opApply/range for each.

std.algorithm.iteration.each can now be called with a lambda taking >2
args. This should work for any input range that returns a tuple and any
type with a non-templated opApply that takes a multi-arg delegate.

Determining the arity of a templated opApply still poses a problem, so
that case is not supported.

This also adds support for `each` with two ref args.

When given a binary function that takes two args by ref,
std.algorithm.iteration.each should use both args by ref.

It was previously discarding ref on the first arg, assuming it was for
an index.

Resolves #15358.


  Commit: 71ee3e530317ced9026f3ab0795edc1147be67f2
      https://github.com/dlang/phobos/commit/71ee3e530317ced9026f3ab0795edc1147be67f2
  Author: Dmitry Olshansky <dmitry.olsh at gmail.com>
  Date:   2016-05-10 (Tue, 10 May 2016)

  Changed paths:
    M std/algorithm/iteration.d

  Log Message:
  -----------
  Merge pull request #3837 from rcorre/each_improved

Improve std.algorithm.iteration.each


Compare: https://github.com/dlang/phobos/compare/f257e8330e5b...71ee3e530317


More information about the phobos mailing list