欢迎来到天天文库
浏览记录
ID:33390616
大小:1.82 MB
页数:200页
时间:2019-02-25
《Effective STL - 50 Specific Ways To Improve Your Use Of The Standard Template Library (2001)(1st)(Scott Meyers)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、EffectiveSTLAuthor:ScottMeyersE-versionismadeby:Strangecat@epubcnThanksisgiventoj1foo@epubcn,whohashelpedtorevisethise-book.ContentContainers........................................................................................1Item1.Chooseyourcontain
2、erswithcare...........................................................1Item2.Bewaretheillusionofcontainer-independentcode................................4Item3.Makecopyingcheapandcorrectforobjectsincontainers.....................9Item4.Callemptyinsteado
3、fcheckingsize()againstzero..............................11Item5.Preferrangememberfunctionstotheirsingle-elementcounterparts...12Item6.BealertforC++'smostvexingparse...................................................20Item7.Whenusingcontainersofnewedpoin
4、ters,remembertodeletethepointersbeforethecontainerisdestroyed............................................................22Item8.Nevercreatecontainersofauto_ptrs....................................................27Item9.Choosecarefullyamongerasingoptio
5、ns..............................................29Item10.Beawareofallocatorconventionsandrestrictions..........................34Item11.Understandthelegitimateusesofcustomallocators........................40Item12.Haverealisticexpectationsaboutthethread
6、safetyofSTLcontainers.43vectorandstring............................................................................48Item13.Prefervectorandstringtodynamicallyallocatedarrays..................48Item14.Usereservetoavoidunnecessaryreallocations............
7、....................50Item15.Beawareofvariationsinstringimplementations............................52Item16.KnowhowtopassvectorandstringdatatolegacyAPIs................57Item17.Use"theswaptrick"totrimexcesscapacity....................................60I
8、tem18.Avoidusingvector................................................................62AssociativeContainers..................................................................65Item19.Understandthedifferencebetweenequalitya
此文档下载收益归作者所有