Mail Archives: djgpp/2002/02/07/07:30:06
David Hilsee wrote:
> <snip>
> > Here is a program and compilation results.
> >
> > The compiler detects some error
> > and informs about "Internal compiler error".
> >
> > Is there an error in my program?
> >
> <snip>
> > for_each(vect.begin(), vect.end(), bind2nd(ptr_fun(foo2), 200)); //
> > Line#53
>
[snip]
>
>
> This message pretty mch says it: you're forming a reference to a reference.
>
> The problem is that the binder that results from bind2nd tries to take the
> argument in its operator() (the first parameter of the function) by
> reference. That parameter, in your code, is already a reference, and that
> makes it try to generate a reference to a reference, which isn't allowed.
>
>
[snip]
Thanks.
We can see that function
void foo1 (AAA& a) {a.set_value (a.get_value() + 100);}
can be used in for_each ()
So, what about
void foo2 (AAA& a, int n) { a.set_value (a.get_value() + n); } ?
Is there any way to do what I want to ?
===========================
Alex Vinokur
mailto:alexvn AT bigfoot DOT com
mailto:alexvnw AT yahoo DOT com
http://up.to/alexvn
http://go.to/alexv_math
===========================
- Raw text -