Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

closed #3

Open
cbyzju opened this issue Aug 4, 2017 · 4 comments
Open

closed #3

cbyzju opened this issue Aug 4, 2017 · 4 comments

Comments

@cbyzju
Copy link

cbyzju commented Aug 4, 2017

No description provided.

@gaoxiang12
Copy link
Owner

Ptr是智能指针类,将在变量退出作用域时自动销毁。
见:https://www.zhihu.com/question/20368881

@cbyzju
Copy link
Author

cbyzju commented Aug 6, 2017

恩恩,做了些实验搞明白了!在退出点云构造的子函数时,我们通过return一个shared_ptr指针的方式,保证在退出子函数时,虽然指针被销毁了,但由于在指针被销毁前,将该指针赋值给了visualOdometry函数中的另外一个指针,所以保证了指针指向的点云数据并没有被销毁,只有当下一次调用该子函数时,才会销毁上一帧的点云数据。我这么理解可以么?

@gaoxiang12
Copy link
Owner

并不对,智能指针只有在引用计数的时候才销毁,即,在没有任何一处继续持有实际点云数据时,才被销毁。

@cbyzju
Copy link
Author

cbyzju commented Aug 6, 2017 via email

@cbyzju cbyzju changed the title Point::Ptr cloud局部变量销毁 closed Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants