Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Question about STL erase function

Reply
Thread Tools

Question about STL erase function

 
 
Richard Herring
Guest
Posts: n/a
 
      01-19-2006
In message <(E-Mail Removed) .com>,
Piotr <(E-Mail Removed)> writes
>After the return of remove_if() to remove elements from the container
>which matches the condition, how can I get the address of all the
>removed elements and call their destructor?
>

No need. container.erase(remove_if(/*...*/), container.end()) will do
it for you.

(Note that the sequence bounded by remove_if() and container.end() is
stuff you no longer need, but not necessarily "the removed elements",
since some of the unwanted elements may have had wanted ones copied into
them.)

--
Richard Herring
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
STL map erase() functions question olanglois@sympatico.ca C++ 8 07-02-2006 08:39 PM
erase vs. erase al.cpwn@gmail.com C++ 7 03-30-2006 11:45 AM
question about the stl erase-remove idiom Nan Li C++ 2 11-08-2005 09:46 PM
How do i erase all information in my orkut and erase the link to the orkut account? mountbatten@gmail.com Computer Support 1 10-31-2005 12:03 AM
How do I erase a file that wont let me erase it? Dale Custer Computer Support 4 07-06-2003 09:48 AM



Advertisments