Re: <instance>& == const <instance>&

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

 



Hi Nieuwenhuizen,

>Can anybody tell  me how to solve this?

You already have an iterator in hand, why doesn't this work...

Persons->remove(Piter);
// Stroustrup C++PL p452

...?  (And doesn't that then invalidate your iterator?)

Why don't use you use the list<>.remove_if(Predicate); function (Stroustrup C++PL p472)?

Or, alternatively, the remove_if(ForwardIter, ForwardIter, Predicate) (Stroustrup C++PL p536) from <algorithm>.

If you have Stroustrup C++PL Special Edition, also look at p956 in Appendix E.

NOTE:  from the compiler warning, I reckon your class may need to have a...

bool operator == (Person const& rhs) const;

...method.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux