作者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://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1512659791.A.16A.html
※ 编辑: nova06091 (125.224.130.3), 12/07/2017 23:17:09
1F:→ stucode: begin() 没有 const 修饰不能在有 const 的 a 上面呼叫。 12/07 23:30
2F:→ stucode: 194 行的 list 是 non-const 的。 12/07 23:31
3F:→ galic: 建议 编译的时候把warning全开喔 有些"显而易见"的问题 12/08 10:46
4F:→ 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