C++ STL notes

来源:互联网 发布:python 编写图形界面 编辑:程序博客网 时间:2024/05/20 23:36

exception safe, type safe, thread safe,reentrant

Item1: Memory-contigious, node-based container

Item2: Encapsulation

Item3: An easy way to make copying efficient, correct, and immune to the slicing problem is to create containers of pointers instead of containers of objects.

Item4: Call empty whenever you need to know whether a container has zero elements.

Item5: Prefer range member functions to single element counterparts. Insert, assignment, and copy. 

Item 6: Be alert for C++'s most vexing parse.

Item 7: When using containers of newed pointers, remember to delete the pointers before the container is destroyed.

          Smart pointer not auto pointer

Item 8: Never create containers of auto_ptrs.

Item 9: Choose carefully among erasing options

原创粉丝点击