Effective STL 17 Use "the swap trick" to trim excess capacity
来源:互联网 发布:应届生程序员面试题 编辑:程序博客网 时间:2024/06/05 10:34
for vector
vector<int>(v.begin(), v.end()).swap(v);
for string
string(s.begin(), s.end()).swap(s);
both to clear a container and to reduce its capacity to the minmum your implementation offers.
vector<int>().swap(v);string().swap(s);
阅读全文
0 0
- Effective STL 17 Use "the swap trick" to trim excess capacity
- 《Effective STL》读书笔记九:Item 17:使用“the swap trick”来削减过剩的容量 Item 18:避免使用vector<bool>
- hdu 1057 (simulation, use sentinel to avoid boudary testing, use swap trick to avoid extra copy.)
- The Trick To Good Software
- The Dangers of Excess Flexibility
- Effective STL 28 How to use a reverse_iterator's base iterator
- Trick:How to use cmwap to access internet(Symbian)
- Simple Trick To Use Web Browsers As Text Editor
- effective stl 第17条: 使用“swap 技巧”除去多余的容量
- How to use map (STL)?-
- Effective STL: 使用swap来修整过剩容量
- Effective STL: 使用swap来修整过剩容量
- one sql to calculate the schema's table capacity
- Effective STL 条款17
- How to use the CAknWaitDialog
- how to use the CAknwaitDialog
- How to use the CAknWaitDialog
- Learn to use the bugster
- ios 上传下载
- Scikit-Learn框架
- Unity协同使用初步总结(StartConroutine_IEnumerator & IEnumeratable)
- Ubuntu Server 命令行下显示中文乱码(菱形)解决办法
- Azure Web应用服务访问Oracle数据库
- Effective STL 17 Use "the swap trick" to trim excess capacity
- 一道趣题
- ACM 进阶
- struts2中Action对请求参数有效性的校验
- Gin安装
- Vue2 指令v-if v-show v-for v-text v-html
- doT.js html模版使用教程
- 海量数据处理
- 开始用 Node.js 编程