Phobos是否有一些可变算法来对l值引用参数进行排序?像 int a=3;
int b=2;
int c=1;
orderInPlace(a,b,c);
// a is now 1
// b is now 2
// c is now 3
而且功能性变异的东西,说order(a, b, c),返回一个元组也将是不错。如果不是,我想我们应该使用std.algorithm:swap
复制http://forum.dlang.org/thread/[email protected]比较响应速度:) 我基本上要能够做到这样的东西: auto result = map!((a, b) => a+b)(lockstep(range1, range2)); 有什么标准使用opApply(Lockstep是)在 结构中围绕输入范围的简短方法? 而且怎么样重新设计的锁步作为一个适当的范围内
在d std.regex.regex()不是纯: import std.regex;
pure void test() // test.d(5): Error: pure function 'test' cannot call impure function 'regex'
{
auto r = regex(r"patern123", "g");
}
为什么? 是否 A.没有
我重复地需要连接格式化字符串,并且想知道在D中writefln()函数之外连接字符串的最短(或最容易读取)方法是什么? 也就是说,我喜欢writefln,在那里你可以例如做的行为: // Some code to init y="2013", m="01", d="02" ...
writefln("%s-%s-%s", y, m, d);
...但我想这样做没有写出来的标准输出。有没有同样