Merge pull request #127 from ros2/publish_const_reference
small changes to make the publish const reference api work
This commit is contained in:
commit
a2592d5d89
1 changed files with 1 additions and 2 deletions
|
@ -295,14 +295,13 @@ public:
|
||||||
return this->publish(unique_msg);
|
return this->publish(unique_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
publish(const MessageT & msg)
|
publish(const MessageT & msg)
|
||||||
{
|
{
|
||||||
// Avoid allocating when not using intra process.
|
// Avoid allocating when not using intra process.
|
||||||
if (!store_intra_process_message_) {
|
if (!store_intra_process_message_) {
|
||||||
// In this case we're not using intra process.
|
// In this case we're not using intra process.
|
||||||
return this->do_inter_process_publish(msg.get());
|
return this->do_inter_process_publish(&msg);
|
||||||
}
|
}
|
||||||
// Otherwise we have to allocate memory in a unique_ptr and pass it along.
|
// Otherwise we have to allocate memory in a unique_ptr and pass it along.
|
||||||
std::unique_ptr<MessageT> unique_msg(new MessageT(msg));
|
std::unique_ptr<MessageT> unique_msg(new MessageT(msg));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue