Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Boost function/bind problem

Reply
Thread Tools

Boost function/bind problem

 
 
Fuzzy Coder
Guest
Posts: n/a
 
      05-31-2012
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boost Problem! Boost.Build not found Soren Python 6 04-16-2007 01:13 PM
#include <boost/shared_ptr.hpp> or #include "boost/shared_ptr.hpp"? Colin Caughie C++ 1 08-29-2006 02:19 PM
Problems mixing boost::lambda::bind and boost::shared_ptr.. Toby Bradshaw C++ 6 06-02-2006 04:12 PM
Any Boost Experts out there for Boost.Regex? Richard Latter C++ 2 05-17-2004 03:12 PM
Boost + Python C/API: Mixing python return types with boost return types Steve Knight Python 2 10-10-2003 10:11 AM



Advertisments