Re: list.remove() crash.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jerry Coffin (jcoffin_at_taeus.us)
Date: 05/16/04


Date: Sun, 16 May 2004 01:25:53 -0600

In article <ehIQgShOEHA.2844@tk2msftngp13.phx.gbl>,
etpolaris@hotmail.com says...
> Thanks for your info. That will not work for me because I need to remove
> certain items from the list. What I' doing now is to put those items to be
> removed into a seperat array and then remove() them one by one. it seems
> working. but still, I think there should be better way. Thanks.

There is. Look up std::list::remove_if. Just for example, to remove
every item less than 100 from a list of ints:

std::list<int> integers;

integers.remove_if(std::bind2nd(std::less<int>(), 100));

-- 
    Later,
    Jerry.
The universe is a figment of its own imagination.


Relevant Pages

  • Re: Why do humans have hairs on their legs....
    ... universe who can see it OR its a figment of your imagination. ... Have you ever corresponded with anyone who knows what a figment of the ... there's a lecture at a museum about 60 miles away ...
    (talk.origins)
  • Re: Engineering Mathematics
    ... I'm perfectly fine believing the universe ... >>is a figment of my imagination. ...
    (sci.electronics.design)
  • Re: Getting a Listing of DLLs Loaded by a Program
    ... You might find this handy: ... The universe is a figment of its own imagination. ...
    (microsoft.public.vc.mfc)
  • Re: libctiny.lib
    ... difference from it (though I'll admit I've never tested it carefully ... The universe is a figment of its own imagination. ...
    (microsoft.public.vc.language)
  • Re: DLL help
    ... While the changes are becoming more subtle, ... The universe is a figment of its own imagination. ...
    (microsoft.public.vc.language)