libstdc++/6532: STL binder1st::operator() not compiling
Paolo Carlini
pcarlini@unitus.it
Thu May 2 05:31:00 GMT 2002
Hi,
your analysis is essentially correct. This is a limitation of the
standard binders... Boost (www.boost.org) to the rescue! Why don't
consider using boost::bind? Like this:
#include <algorithm>
#include <functional>
#include <boost/bind.hpp>
using namespace std;
using namespace boost;
struct A {
int _a;
};
struct B {
void m(A &x) { x._a = 5; }
void f();
};
void B::f()
{
A a[5];
for_each(&a[0], &a[5], bind(&B::m, ref(this), _1));
}
Ciao,
Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6532
More information about the Gcc-bugs
mailing list