作者nova06091 ()
看板C_and_CPP
標題[問題] 自定義串列Iterator
時間Thu Dec 7 23:16:26 2017
開發平台(Platform): (Ex: Win10, Linux, ...)
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
gcc
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
自定義的iterator用在複製建構子的時候無法正確運作
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
https://repl.it/repls/AcrobaticUnwelcomeAegeancat
照著Horowitz的資結C++實作這個Iterator類別,194行可以正常使用但是在複製建構子卻不?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.224.130.3
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1512659791.A.16A.html
※ 編輯: nova06091 (125.224.130.3), 12/07/2017 23:17:09
→ stucode: begin() 沒有 const 修飾不能在有 const 的 a 上面呼叫。 12/07 23:30
→ stucode: 194 行的 list 是 non-const 的。 12/07 23:31
→ galic: 建議 編譯的時候把warning全開喔 有些"顯而易見"的問題 12/08 10:46
→ galic: 編譯器都有幫你發現 12/08 10:46
※ 編輯: nova06091 (49.214.32.56), 12/08/2017 10:58:51
可以了 謝謝你們 > <
※ 編輯: nova06091 (49.214.32.25), 12/11/2017 13:31:45