|
Boost Users : |
Subject: Re: [Boost-users] proper erasing from ptr_vector
From: anony (janezz55_at_[hidden])
Date: 2009-03-19 17:59:20
Archie14 pravi:
> I have
>
> 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);
When you erase a pointer from ptr_vector it will delete it.
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