ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

boost:bind self-pointing pointer

asked 2014-04-21 23:44:33 -0600

Younghyo gravatar image

I'm writing a test program about actionlib. Referencing the wiki document of SimpleActionServer. However, I makes a error because of this instruction.

Server server(n, "do_dishes", boost::bind(&execute, _1, &server), false);

The variable server is used before it's allocated as server. Is that possible? At least, my visual studio 2010 compiler doesn't understand that style of code. Please help me.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-04-22 02:53:37 -0600

BennyRe gravatar image

The code example on the wiki page seems to be wrong.

If you look at this tutorial you see that the placeholder for the callback arguments _1 has to be after the pointer to the object.

Does this solve your problem?

edit flag offensive delete link more

Comments

I saw the tutorial you suggested already. In there, they uses a wrapping class. it works. (with a warning). but i want to do this by not making additional class. i also asked this strange syntax question to stackoverflow.com. i finally notified that MSVC cannot build it while G++ can do it.

Younghyo gravatar image Younghyo  ( 2014-04-22 14:19:18 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-21 23:44:33 -0600

Seen: 261 times

Last updated: Apr 22 '14