STL中的容器非常优秀。它们提供了前向和逆向遍历的迭代器(通过begin、end、rbegin等);它们能告诉你所容纳的对象类型(通过value_type的typedef);在插入和删除中,它们负责任何需要的内存管理;它们报告容纳了多少对象和最多可能容纳的数量(分别通过size和max_size);而且当然当容器自己被销毁时会自动销毁容纳的每个对象。
Containers in the STL are remarkably smart. They serve up iterators for both forward and reverse traversals (via begin, end, rbegin, etc.): they tell you what type of objects they contain (via their value_type typedef); during insertions and erasures, they take care of any necessary memory management; they report both how many objects they hold and the most they may contain (via size and max_size, respectively); and of course they automatically destroy each object they hold when they (the containers) are themselves destroyed.
Containers in STL are excellent.They offer iterators and reverse iterators(by begin,end,rgeging,etc.);they can tell you the type of the objects which they contain(by their value_type typedef); when inserting and deleting, they take charge of all the necessary memory management; they can report how many objects they have contained and how many objects they can contain(by size and max_size respectively); moreover of course a container destroys all the objects it holds when itself is destroyed.