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);
...但我想這樣做沒有寫出來的標準輸出。有沒有同樣