C + + Primer (fourth edition) after class exercise 9.26 Deleting a container element

Source: Internet
Author: User
Exercise 9.26: If you have the following IA definition, copy ia into a vector container and a list container. Use the erase function of a single iterator parameter version to set the odd value of the list container

element is removed and then the even values in the vector container are removed.

Code:


Summary: (1) When you define vector variables, you can initialize them with arrays;

(2) The vector container returns an iterator to the next element after the element is deleted using the erase function. When using the INSERT or erase function to avoid an iterator invalidation,

It is recommended that you get the return value of INSERT, erase as the new iterator.

C + + Primer (fourth edition) after class exercise 9.26 Deleting a container element

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.