看板 EE_DSnP 關於我們 聯絡資訊
因為有幾個同學有同樣的情況,就直接po在板上。 有同學反應程式在自己電腦可以編譯,不過卻沒有分數並被標記以下的compile error: no matching function for call to 'std::pair<std::string&, CmdExec*>::pair(~~~) 我google了一下,找到了相關的問題 http://stackoverflow.com/questions/3769781/stdpair-of-references No, you cannot do this reliably in C++03, because the constructor of pair takes references to T, and creating a reference to a reference is not legal in C++03. Notice that I said "reliably". Some common compilers still in use do not allow forming a reference to a reference, but more recently do allow it as they implement reference collapsing (T& is T if T is a reference type). If your code uses such things, you cannot rely on it to work on other compilers until you try it and see. 因為慣用的所上Server的compiler版本gcc version 4.2.4,的確不允許這樣使用, 我試著用gcc version 4.4.4,則就編譯成功了。 故部分同學的分數已補回了。 不過因為基本上還是希望同學寫的程式是 可以在一般平台上都能順利編譯(portability?)並正確運作(reliability?)的, 所以在Compile部分還是會酌扣一點分數! ===成績更新=== bxxxx2x07 299 bxxxx2x22 105 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.24.232 ※ 編輯: sion0814 來自: 140.112.24.232 (01/14 20:12)
tomap41017:請問助教這次作業可以使用tr1/functional嗎? 01/15 13:54