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



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

--
jonner



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