C++????????÷????
???????????? ???????[ 2014/9/19 13:39:18 ] ??????????????? Net C++
????7??boost::weak_ptr
????boost::weak_ptr ???? boost ???????? namespace boost ?У????????? #include<boost/smart_ptr.hpp> ???????á?
??????? boost::weak_ptr ???????????????????潲??????????? boost::scoped_ptr??boost::shared_ptr ?????????????????????е???????????????????????????? boost::weak_ptr????????Щ?????????????????
????????С????? boost::weak_ptr ?????? boost::shared_ptr ???????????????????????????????????????????????ü?????boost::weak_ptr ?? boost::shared_ptr ???????Observer?????????????ζ?? boost::weak_ptr ??? boost::shared_ptr ?????????????????????ü????????????? boost::shared_ptr ?Ч??????? boost::weak_ptr ?????Ч??
??????????????????????
????void TestWeakPtr() {
????boost::weak_ptr<Simple> my_memory_weak;
????boost::shared_ptr<Simple> my_memory(new Simple(1));
????std::cout << "TestWeakPtr boost::shared_ptr UseCount: " << my_memory.use_count() << std::endl;
????my_memory_weak = my_memory;
????std::cout << "TestWeakPtr boost::shared_ptr UseCount: " << my_memory.use_count() << std::endl;
????}
??????н?????
????Simple: 1
????TestWeakPtr boost::shared_ptr UseCount: 1
????TestWeakPtr boost::shared_ptr UseCount: 1
????~Simple: 1
????????????????????????????????ü???????????仯?????????????????????????????????????
???????????????????boost::weak_ptr ????????????????????????????????????????κ????????? boost::weak_ptr ?????????????????У?????????????????????????????????????????????????ж?????? boost::weak_ptr?????????????? boost::shared_ptr????????????????????? boost::weak_ptr ???????????????????????????????????????? boost::shared_ptr ?????ü????????????????????????????
????8??boost::intrusive_ptr
????boost::intrusive_ptr???? boost ???????? namespace boost ?У????????? #include<boost/smart_ptr.hpp> ???????á?
???????????? 6 ??????????????????????? C++ ???????????????????ж?????? boost::intrusive_ptr??????????????????????????????????ü???????????????????????ü?????????????????????b??????????о????????????????????????????ù??????????????????о??????????J??
???????????
????????????????????????б??????Щ??????????????
????1?????????? boost ???????£??????? std::auto_ptr??????????????? C++ ??????????????????[2]??
????2??????????????蹲???????£???? boost::scoped_ptr??????????????? boost::scoped_array????
????3???????????????????£???? boost::shared_ptr??????????????? boost::shared_array????
????4??????????? boost::shared_ptr ??????????????????ü?????????£???? boost::weak_ptr???????????????????С?
????5????????????????????????????У???????? delete ???????? C ????? free ??????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????