Boost logo

Boost Users :

Subject: Re: [Boost-users] passing pointer as function arg using boost::bind
From: reminisc3_at_[hidden]
Date: 2014-03-20 23:17:45

In your function try:

MyVar**  var

As the parameter

Or deref the pointer

Compile error or unexpected results?

Also, note that you would be modifying the pointer and not the object

Sent from my BlackBerry 10 smartphone.
From: Lane
Sent: Thursday, March 20, 2014 11:08 PM
Reply To:
Subject: [Boost-users] passing pointer as function arg using boost::bind

I’m having a problem passing a pointer as an arg via boost::bind and was hoping anyone could help out. I was able to pass ‘a’ just fine, but the second arg ’b’ I’m having a problem with.

Here is what I have.                

namespace NS {

class MyThread {

    int doIt(NS::A a, B *b);

// …

A a; 

B *b = new B();

NS::MyThread f_thread;


boost::thread workerThread(boost::bind(&NS::MyThread::doIt, &f_thread,

    boost::ref(a), boost::ref(b)));

Any help much appreciated.

Boost-users mailing list

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at