Re: removing a elt from a std::vector in C++
- From: "Naveen Verma" <ernaveenverma gmail com>
- To: "Jonathon Jongsma" <jonathon jongsma gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: removing a elt from a std::vector in C++
- Date: Wed, 18 Jul 2007 21:42:11 +0300
Hi,
On 7/18/07, Jonathon Jongsma <jonathon jongsma gmail com> 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
Yes you are right, as per my understanding also, if we need to do lots if insertion/deletion then using list is efficient, but if we need to do less insertion/deletion and mostly lookup then vector is better.
-Br
Naveen
--
jonner
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]