Effective STL
最新书摘:
-
JerryZ2015-11-15*To eliminate all objects in a container that have a particular value:If the container is a vector, string, or deque, use the erase-remove idiom.If the container is a list, use list::remove.If the container is a standard associative container, use its erase member function.*To eliminate all objects in a container that satisfy a particular predicate:If the container is a vector, string, or deque, use the erase-remove_if idiom.If the container is a list, use list::remove_if.If the container is a standard associative container, use remove_copy_if and swap, or write a loop to walk the container elements, being sure to postincrement your iterator when you pass it to erase.*To do something inside the loop (in addition to erasing objects):If the container is a standard sequence container...
-
JerryZ2015-11-152.the remove member function is the best way to get rid of elements with a specific value when c is a list.
-
JerryZ2015-11-151.the erase-remove idiom is the best way to get rid of elements with a specific value when c is a vector, string, or deque.
-
Marius2013-01-03拷进去,拷出来。这就是STL的方式。... ,拷贝对象是STL的方式。