The actual delete element in the C + + vector uses the Std::vector::erase () method in the container Vecrot

Source: Internet
Author: User
Tags function prototype

The actual deletion element in the C + + vector uses the std::vector::erase () method in the container Vecrot.

Std::remove () in C + + does not delete the element because the container's size () does not change, only the replacement of the element.

1.std::vector::erase ()

Function prototype: Iterator erase (iterator position); Delete the specified element

Iterator Erase (iterator first, iterator last); Delete elements within a specified range

Return value: Points to the next element that deletes the element (or range). (An iterator pointing to the new location of the element, the followed the last element, erased by the function call. The container End If the operation erased the last element in the sequence.)

Http://dig.chouti.com
http://dig.chouti.com/link/6301183
http://dig.chouti.com/link/6301185
http://dig.chouti.com/link/6301188
http://dig.chouti.com/link/6301189
http://dig.chouti.com/link/6301190
Dig.chouti.com
dig.chouti.com/link/6301183
dig.chouti.com/link/6301185
dig.chouti.com/link/6301188
dig.chouti.com/link/6301189
dig.chouti.com/link/6301190

The actual delete element in the C + + vector uses the Std::vector::erase () method in the container Vecrot

Related Article

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.