Re: Strange std::remove behaviour
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 12/09/04
- Next message: Bonj: "Re: Another makefile question (probably the last)"
- Previous message: Bonj: "Re: Another makefile question (probably the last)"
- In reply to: uvts_cvs_at_yahoo.com: "Strange std::remove behaviour"
- Next in thread: Tom Widmer: "Re: Strange std::remove behaviour"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 09 Dec 2004 11:49:03 -0500
uvts_cvs@yahoo.com wrote:
> std::vector<int> v(1, 0);
> std::remove (v.begin(), v.end(), 0);
>
> After executing this two lines of code (compiled with VC7.1) v.size()
> returns 1. Isn't that strange?
> Am I missing something?
'remove' doesn't truly remove, it actually rearranges the elements
and returns the iterator which you then can pass to 'erase' if you
do need the elements removed. RTFMSDN, especially the sample program.
V
- Next message: Bonj: "Re: Another makefile question (probably the last)"
- Previous message: Bonj: "Re: Another makefile question (probably the last)"
- In reply to: uvts_cvs_at_yahoo.com: "Strange std::remove behaviour"
- Next in thread: Tom Widmer: "Re: Strange std::remove behaviour"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|