d过滤数组至新数组

import std.stdio;
import std.algorithm;

void main() {
  auto arr = [ 1, 2, 3, 4, 5, 6, 7 ];

  // The default strategy is SwapStrategy.stable
  arr = arr.remove!(a => a % 2, SwapStrategy.unstable);

  writeln(arr);
}

原文

posted @ 2021-10-10 11:10  zjh6  阅读(14)  评论(0)    收藏  举报  来源