Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: Advanced
Dec 19, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

The remove() Algorithm

The Standard Library defines the std::remove() algorithm, which moves desired elements to the front of a container and returns an iterator pointing to the end of the sequence of the desired elements. The elements to be removed are positioned past the sequence's end. remove() is declared in the header <algorithm> as follows:
ForwardIterator  remove (ForwardIterator first,
                         ForwardIterator last,
                         const T& value);

remove() removes all the elements in the range (first, last) that are equal to 'value'. It returns an iterator that points to the end of the resulting range. However, remove() doesn't actually reduce the size of the sequence nor does it erase the removed elements. Instead, it copies the values that are to be retained to the beginning of the sequence, while pushing the
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date