[Bug libstdc++/12549] Compile error on attempt to use pointer to member function with iterator
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Oct 9 14:59:00 GMT 2003
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)();
}
}
More information about the Gcc-bugs
mailing list