Boost function/bind problem

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top