Re: removing a elt from a std::vector in C++



Jonathon Jongsma wrote:
> On 7/18/07, Grizzly(Francis Smit) <grizzly smit id au> wrote:
>   
>> Hi list,
>>
>>          basically I want to remove an elt from a std::vector
>>          but I dont know of any method to do so does any one
>>          know how.
>>     
>
> This is really a C++ question and not a gtkmm question, so this isn't
> really the right list for it.  But anyway, you can remove an element
> from a vector with vector<>::erase(iterator) [1].  Note that it could
> be expensive to do this for a vector, it's must less expensive to
> remove an element from a std::list, so if you're doing it a lot, you
> might consider whether you're using the correct container type.
>
> [1] http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1vector.html#24fda834262bd1148da26ef6f5f9ab1e
>
>   
Thank you that did the trick  btw do u know a good C++ list for future use

-- 
  In my life God comes first.... but Linux is pretty high after that :-D
Grizzly(Francis Smit)
http://www.geekcode.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GM/CS/P/PA d- s+:+> a+>? C++++ UL++++@ P+ L+++ E--- W+++ N+(++) K w--- M-- V-- PS(+) PE(-) Y+(++) PGP++ t+(++) 5 X- R- tv b+++(++++) DI(--) D G e++(+++) h-- r- y-
------END GEEK CODE BLOCK------




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]