Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roscpp: topic.h is not compatible with c++11 #483

Closed
taketwo opened this issue Aug 4, 2014 · 1 comment
Closed

roscpp: topic.h is not compatible with c++11 #483

taketwo opened this issue Aug 4, 2014 · 1 comment

Comments

@taketwo
Copy link
Contributor

taketwo commented Aug 4, 2014

This line gives the following error when compiled with c++11 option:

/opt/ros/indigo/include/ros/topic.h|64 col 12| error: no viable conversion from 'MConstPtr' (aka 'shared_ptr<const stdr_msgs::RobotIndexedVectorMsg_<std::allocator<void> > >') to 'bool'
         return message_;

The reason is that in C++11, shared_ptr has an explicit operator bool which means that a shared_ptr can't be implicitly converted to a bool. A trivial fix could be applied to make the code compatible with both the new and the old stardards:

return static_cast<bool>(message_);

Alternatively, one could write:

return message_.get() != 0;

Please let me know which version is preferable and I will submit a pull request.

@dirk-thomas
Copy link
Member

The first proposed fix lgtm. Please provide a pull request against the indigo-devel branch. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants