|
Boost Users : |
Subject: Re: [Boost-users] proper erasing from ptr_vector
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-19 13:56:13
AMDG
Archie14 wrote:
> ptr_vector<A> lst;
>
> When I need to erase element from this container - should I just do
> A* el;
> iterator it = std::find (lst.begin(), lst.end(), el);
> lst.erase(it);
>
> or
>
> A* el;
> iterator it = std::find (lst.begin(), lst.end(), el);
> delete lst.erase(el);
>
erase deletes the element and returns an iterator to the
next element.
In Christ,
Steven Watanabe
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net