Precautions for containers

Source: Internet
Author: User

1. Global function: Find (Begin,end,value); Delete all elements that are value

2. Always pay attention to the extra-tails when using iterators.

3.list::remove (Elem); Delete all elements of Elem

4.int set::erase (Elem); Delete all elements of Elem

5.iterator find (Elem); Find the first elem.

6.pair<set<t>::iterator,bool result> Set::insert (elem); Result for Insert success

7. When iterating over elements, beware of the presence of iterators

8.map Insertion Method Three: C.insert (Map<t1,t2>::value_type (T1 A, T2 b));

9.map A;

A[key]=value; exists on replace, does not exist insert

10.multimap is a typical container for dictionaries

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.