phobos

    1熱度

    2回答

    以下d程序崩潰輸入939971或更高,但不爲輸入939970或更低: #!/usr/bin/rdmd --shebang -w -d-debug --relocation-model=pic import std.stdio; import std.bigint; import std.conv; import std.array; //extern (C) void fibon

    4熱度

    3回答

    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

    8熱度

    1回答

    最近我對D編程語言感興趣。我剛開始學習它,並且來自C++背景。我想知道是否有相當於std :: remove_if。我只看到刪除dlang站點上的文檔。 如果沒有直接的等價關係,在D中獲得相同結果的適當或最常用的方法是什麼? 編輯:我要補充一點,我在的情況下我想擦除刪除

    2熱度

    1回答

    我經常在Ubuntu 13.10上本地重建和使用DMD git master。昨天我d工具鏈未能全部d程序有錯誤鏈接:從DMD 實例彙編輸出: /home/per/opt/x86_64-unknown-linux-gnu/dmd/bin/../lib/libphobos2.a(sections_linux_4c8_e6.o):src/rt/sections_linux.d:function _D

    4熱度

    1回答

    我對x86使用DMD 2.062。 module test; private enum test1 { one, two, three, } private enum test2 { one, two, three, } auto ct = cartesianProduct([EnumMembers!test1],

    3熱度

    1回答

    複製http://forum.dlang.org/thread/[email protected]比較響應速度:) 我基本上要能夠做到這樣的東西: auto result = map!((a, b) => a+b)(lockstep(range1, range2)); 有什麼標準使用opApply(Lockstep是)在 結構中圍繞輸入範圍的簡短方法? 而且怎麼樣重新設計的鎖步作爲一個適當的範圍內

    2熱度

    1回答

    在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.沒有

    3熱度

    2回答

    我至今沒有發現我怎麼可以很容易地檢查是否字符串與D.某個字符開始 我想是這樣的: if (my_str.startswith("/")) { // Do something } 最近我發現了「chompPrefix」 (here),但那不是我想要的。

    4熱度

    1回答

    我重複地需要連接格式化字符串,並且想知道在D中writefln()函數之外連接字符串的最短(或最容易讀取)方法是什麼? 也就是說,我喜歡writefln,在那裏你可以例如做的行爲: // Some code to init y="2013", m="01", d="02" ... writefln("%s-%s-%s", y, m, d); ...但我想這樣做沒有寫出來的標準輸出。有沒有同樣

    4熱度

    1回答

    所以我與d編程語言今天擺弄周圍,只是找不到任何關於如何對std.algorithm.map 返回類型使用 std.array.replace任何信息 void main() { import std.stdio : writeln; writeln(test([1, 2, 3])); // desired result: [1, 3, 4] } auto test(in