|
Boost Users : |
From: Phil Nash (phil.nash.lists_at_[hidden])
Date: 2002-07-14 09:02:52
> > Just rewrite the line that constructs bind something like this:
> >
> > bf = boost::bind(&MyClass::MyMember,&mcl, _1, _2, _3);
>
> Thanks, that works. I had assumed that if the ordinal positions are not
> supplied, that they would just go in order. Evidently ever parameter not
> supplied must be given an ordinal position. That makes sense since bind
> needs to know how many parameters there are. The documentation is really
> deficient in explaining this.
It does skim over it a bit, but it's there in the examples. Like I said I
did it wrong the first time too, but it does make sense as you say.
> However it doesn't work in VC6 if I change my member function to have
'void'
> return and I change my boost::function signature to
> boost::function3<void,int,int,int> bf; . Now I get:
>
> error C2562: '()' : 'void' function returning a value etc. What a PITA !
Hmmm... I tried your example code (now I have access to my dev machine) and
it worked fine for me with a void function. You didn't forget to remove the
return statement (probably returning "a") from your method did you?
It is true that VC++ 6 doesn't have void returns, but those clever chaps who
wrote boost::function worked around it so it works as it should :-)
If you definitely did remove your return statement then post the full code
again here for further inspection.
Regards,
[)o
IhIL..
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net