Summarize my experience and lessons in the work.
You can use the list, set, or map traversal to remove certain elements:
Correct use of Method 1
Copy Code code as follows:
std::liststd::listfor (itlist = List.begin (); itlist!= list.end ();)
{
if (Willdelete (*itlist))
{
Itlist = List.erase (itlist);
}
Else
itlist++;
}
correct use of Method 2
Copy Code code as follows:
std::liststd::listfor (itl
Sequential containers::(vectors and lists and deque)The erase iterator not only invalidates all iterators that point to the deleted element, but also invalidates all iterators after the deleted element, so erase (iter++) cannot be used, but the return value of erase is the next valid iterator, so the correct method is:: For (iter = C.begin (); ITER! = C.end ();)iter = C.erase (ITER);Associative containers::(map and set are more commonly used) The eras
This paper mainly combines some characteristics of SQLSERVER2008 spatial database to explain some technical points of Silverlight in vector map drawing. The server side is responsible for providing data services, the client is responsible for drawing, of course, this process will encounter performance bottlenecks, but this article focuses on the map data Model tr
C ++ STL (vector, map, set, list) member function arrangement, stlvector
/* In the recent ACM competition, I forgot the member function when I used it. The thief was embarrassed and made preparations for the future competition */
LIST: constructor list
/* recently ACM game, used to forget the member function, the thief embarrassed, to the next race to do the preparation * *LIST: constructor list C++stl (vector,map,set,list) member function collation
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.