Comments (3)
- 返回值和传参问题提得非常好, 我的错误,没有注意到。
- 尽力。Java程序员写C++我猜应该就是这样。会尽快脑补缺失的东西。往后应该好些。
- 我给的接口iteraotr() 返回的是Iterator * . 你看一下我Test里面迭代器的用法.,需要释放它。是可以同时有多个Iterator的。
- 写Test是为了方便大家快速调试,发现基本的错误。最重要的目标是 给出实现类使用的illustration。我没有时间也无意写比较完善的Test。完成Assignment的最后一个步骤就是完善Test。不要用你切题的思维来做Assignment 吧。 我喜欢你提的意见。不喜欢你说话的语气
- 给出你的实现,feel free to modify the header file. ^_^
提出了很好的问题,谢谢~
from codebase.
设计接口自己写是一件很烦的事情,建议可以参考 STL 库来写作业要求。毕竟 STL 本身在接口的设计和风格上都是很值得学习的。
最后,第三个关于iterator的问题我也觉得如果已经是指针,那么指针出作用域的时候没办法通过析构函数通知回来,这样的话我实在想不出什么好的办法可以存储和销毁这个迭代器。(因为题目后面说“感觉不到指针的存在”我的理解就是无需用户手动释放,或者至少是满足“谁申请谁释放”原则)
唯一能想到的方法是添加一个 ArrayList<T>::ArrayListItem
类继承自 iterator<T>
,返回指针的时候通过向父类的转换来提供 iterator 的访问控制。而且因为 ArrayListItem 本身是列表元素,除非 remove 否则不需要删除,也就没了释放的问题。(但是这样做总感觉不是很好……
from codebase.
@tiansh 为什么在别的页面 @不到你。 关注一下 #76
from codebase.
Related Issues (18)
- Rule of Three. HOT 4
- TA说(抛砖引玉) HOT 2
- 为什么需要测试
- Github教育福利
- 为什么不用引用 HOT 3
- assignment1&3 HOT 1
- _(:з」∠)_ 为什么不需要用到fetch HOT 1
- First Issue HOT 1
- Share HOT 1
- 关于BM算法的一点问题 HOT 1
- Assignment4 值得关注的提交
- eric's pull requests HOT 1
- Assignment1 TA's solution
- 与课程仓库同步 HOT 2
- 不用自己释放指针,是不是可以这样? HOT 4
- Assignment 2 题目 HOT 3
- pull request 被close掉同学注意。Git Branch 的使用[重要]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codebase.