- 博客(7)
- 收藏
- 关注
原创 c++ primer P503
<br />string TextQuery::text_line(line_no line) const<br />{<br />if (line < lines_of_text.size())<br />return lines_of_text[line];<br />throw std::out_of_range("line number out of range");<br />}<br />该函数带有一个行号参数,返回该行号所对应的输入文本行。由于上述代码<br />使
2011-04-09 10:28:00 245
原创 the difference b/w set and list
<br />elements in set can't be changed wihle elements in list can be changed. they are both used to search. and elements in set are unique.
2011-04-07 04:52:00 240
原创 reserve()
<br />假设希望一次读取一个字符并写入 string 对象,而且<br />已知需要读入至少 100 个字符,考虑应该如何提高程序<br />的性能?<br /> <br />实现reserve比较大的capacity,这样在增长的过程中就不必一直重新分配内存。每次分配的capacity是原有capacity的3/2。
2011-04-03 12:07:00 306
原创 process a container in a reverse order
list lst1;list::iterator iter1 lst1.begin(), iter2=lst1.end();while(iter2!=iter1) cout
2011-03-31 11:22:00 177
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人