This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
<instance>& == const <instance>&
- From: "Direct-ADSL" <jk at nieuwenhuizen-jk dot nl>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 21 Jul 2005 09:02:51 +0200
- Subject: <instance>& == const <instance>&
- Reply-to: "Direct-ADSL" <jk at nieuwenhuizen-jk dot nl>
I have the same problem as mentioned last week, but I can't cast the 'const'
out using void pointers or a simple cast like
list<Person> Persons;
list<Person> :: iterator Piter;
Person * MyPerson;
for ( list < Person > :: iterator Piter = Persons -> begin(); Piter !=
Persons -> end(); Piter++ ) {
if ( .... ) {
// Persons -> erase ( * ( static_cast<list<Person> :: iterator > (
Piter ) ) ); // list.tcc :: 97
Persons -> remove ( * ( static_cast<list<Person> :: iterator > (
Piter ) ) ); // Stroustrup, p 473, 414, 130
/*
* This gives:
* /usr/include/g++/bits/list.tcc: In member function `void std::list<_Tp,
* _Alloc>::remove(const _Tp&) [with _Tp = Person, _Alloc =
* std::allocator<Person>]':
* ...
* /usr/include/g++/bits/list.tcc:189: error: no match for `Person& == const
Person&' operator
*/
Can anybody tell me how to solve this?
Thanks
Nieuwenhuizen
2005-07-21
----------------------------------------------------------------------------
--