Boost logo

Boost Users :

Subject: Re: [Boost-users] proper erasing from ptr_vector
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-23 09:24:02


Steven Watanabe skrev:
> 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);
>>

Replace "A* el" with "A el". Objects are compared not by their pointer
value, but by the paointee.

-Thorsten


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