0

I have a function that takes a PCL point cloud as an argument.

void PointCloudOdometry::addKeyFrame(PointCloud::Ptr map_base)
{

...

I am trying to start a boost::thread that runs this function.

PointCloud::Ptr msg_base(new PointCloud);

boost::thread workerThread(&addKeyFrame, msg_base);

According to this:

How to pass an argument to boost::thread?

this should work. But I am getting:

Severity    Code    Description Project File    Line    Suppression State
Error   C2276   '&': illegal operation on bound member function expression  

What am i missing?

Thank you.

anti
  • 3,011
  • 7
  • 36
  • 86
  • Is `addKeyFrame` a class member function? – NathanOliver Oct 11 '17 at 18:47
  • Thanks for your reply. Both `addkeyframe` and the function containing the thread constructor are in the same class /namespace. – anti Oct 11 '17 at 18:48
  • As in the duplicate: ` workerThread = new boost::thread(&PointCloudOdometry::addKeyFrame, this, msg_base);` works here. Thank you – anti Oct 11 '17 at 18:53

0 Answers0