This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12549] Compile error on attempt to use pointer to member function with iterator
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Oct 2003 14:59:03 -0000
- Subject: [Bug libstdc++/12549] Compile error on attempt to use pointer to member function with iterator
- References: <20031009131409.12549.pavenis@latnet.lv>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12549
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-09 14:59 -------
The code is invalid, try this instead as the operator * is only one that can access the element that
the iterator points.:
#include <vector>
struct foo
{
void a (void);
void b (void);
int x;
};
void bar ( void (foo::*funct) (void),
std::vector<foo> & data )
{
for (std::vector<foo>::iterator iter=data.begin();
iter!=data.end();
++iter)
{
((*iter).*funct)();
}
}