真在学习c++模板,在看轮子哥的cpplinq时的疑问
迷茫
迷茫 2017-04-17 13:39:21
0
3
533


在这里,后面的成员函数都没有用到values,为什么不能删掉?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
洪涛

Cannot be deleted.

This is related to the mechanism of std::shared_ptr. Here, values ​​stores a reference to a vector, which will be released after storage_iterator destruction. Saving this reference ensures that as long as storage_iterator survives, the reference objects (values) bound to the iterator will also survive.

刘奇

Do you want to delete the initialization of values ​​in the constructor or delete the entire values ​​member?

洪涛

..........After deleting it, what do you use this class for?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!