Giter Club home page Giter Club logo

Comments (3)

whimsycwd avatar whimsycwd commented on July 27, 2024
  1. 返回值和传参问题提得非常好, 我的错误,没有注意到。
  2. 尽力。Java程序员写C++我猜应该就是这样。会尽快脑补缺失的东西。往后应该好些。
  3. 我给的接口iteraotr() 返回的是Iterator * . 你看一下我Test里面迭代器的用法.,需要释放它。是可以同时有多个Iterator的。
  4. 写Test是为了方便大家快速调试,发现基本的错误。最重要的目标是 给出实现类使用的illustration。我没有时间也无意写比较完善的Test。完成Assignment的最后一个步骤就是完善Test。不要用你切题的思维来做Assignment 吧。 我喜欢你提的意见。不喜欢你说话的语气
  5. 给出你的实现,feel free to modify the header file. ^_^

提出了很好的问题,谢谢~

from codebase.

tiansh avatar tiansh commented on July 27, 2024

设计接口自己写是一件很烦的事情,建议可以参考 STL 库来写作业要求。毕竟 STL 本身在接口的设计和风格上都是很值得学习的。

最后,第三个关于iterator的问题我也觉得如果已经是指针,那么指针出作用域的时候没办法通过析构函数通知回来,这样的话我实在想不出什么好的办法可以存储和销毁这个迭代器。(因为题目后面说“感觉不到指针的存在”我的理解就是无需用户手动释放,或者至少是满足“谁申请谁释放”原则)
唯一能想到的方法是添加一个 ArrayList<T>::ArrayListItem 类继承自 iterator<T> ,返回指针的时候通过向父类的转换来提供 iterator 的访问控制。而且因为 ArrayListItem 本身是列表元素,除非 remove 否则不需要删除,也就没了释放的问题。(但是这样做总感觉不是很好……

from codebase.

whimsycwd avatar whimsycwd commented on July 27, 2024

@tiansh 为什么在别的页面 @不到你。 关注一下 #76

from codebase.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.