This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

<instance>& == const <instance>&


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


----------------------------------------------------------------------------
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]