Skip to content

hdxa完成了作业 #65

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

hdxa完成了作业 #65

wants to merge 1 commit into from

Conversation

hdxa
Copy link

@hdxa hdxa commented Sep 8, 2022

这两个指针会造成什么问题?请修复
会造成循环指针,导致俩个指针都没办法释放,同时课上老师说,智能指针会带来一定的性能损耗。

这个构造函数有什么可以改进的?
可以用初始化表达式,同时利用常引用,可以避免不必要的拷贝

应输出多少次?为什么少了?
不会。。但根据老师课上的知识,猜测应该是循环指针,父节点被释放了,导致所属的子节点也被释放,所以少了

为什么删除拷贝赋值函数也不出错?
因为类实现了默认移动赋值函数,编译器会尝试调用拷贝构造函数,这相当于直接构造对象,触发了移动语义,从而进一步调用移动赋值函数

剩下的都不会,这真的是入门级别的吗,0基础纯萌新表示受到一万点暴击伤害(需要去哪恶补什么知识。。。),但我是不会放弃的,加油~

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant