F
Fuzzy Coder
Hello there.
I am trying to use the Boost function type in conjunction with bind, in
order to
homogenise some code.
class C1
{
public:
void
someOp(int i, float f) { /* ... */ } ;
}
class C2
{
public:
void
otherOp(int i, float f) { /* ... */ } ;
}
main()
{
typedef boost::function<void (int, float) > F ;
F func[2] ;
C1 c1 ;
C2 c2 ;
I want to use boost::bind to do the following abstract functions :
f[0] = lambda(int i, float f) : c1.someOp(i,f) ;
f[1] = lambda(int i, float f) : c2.otherOp(i,f) ;
I have achieved the above when the ops on C1/C2 only have one input
argument (op(int) etc) . But when I try functions with more than one
argument, my attempts fail when I use boost::bind.
If anyone can show how f[0] and f[1] would be defined using boost::bind
etc, it would be much appreciated.
Thanks in advance
I am trying to use the Boost function type in conjunction with bind, in
order to
homogenise some code.
class C1
{
public:
void
someOp(int i, float f) { /* ... */ } ;
}
class C2
{
public:
void
otherOp(int i, float f) { /* ... */ } ;
}
main()
{
typedef boost::function<void (int, float) > F ;
F func[2] ;
C1 c1 ;
C2 c2 ;
I want to use boost::bind to do the following abstract functions :
f[0] = lambda(int i, float f) : c1.someOp(i,f) ;
f[1] = lambda(int i, float f) : c2.otherOp(i,f) ;
I have achieved the above when the ops on C1/C2 only have one input
argument (op(int) etc) . But when I try functions with more than one
argument, my attempts fail when I use boost::bind.
If anyone can show how f[0] and f[1] would be defined using boost::bind
etc, it would be much appreciated.
Thanks in advance