Skip to content

Commit

Permalink
accept custom allocator for LoanedMessage. (#2672)
Browse files Browse the repository at this point in the history
* accept custom allocator for LoanedMessage.

Signed-off-by: Tomoya Fujita <[email protected]>

* move message allocator using directives to public.

Signed-off-by: Tomoya Fujita <[email protected]>

---------

Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya authored Nov 21, 2024
1 parent 64dd644 commit 7e9ff5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rclcpp/include/rclcpp/loaned_message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ namespace rclcpp
template<typename MessageT, typename AllocatorT = std::allocator<void>>
class LoanedMessage
{
public:
using MessageAllocatorTraits = rclcpp::allocator::AllocRebind<MessageT, AllocatorT>;
using MessageAllocator = typename MessageAllocatorTraits::allocator_type;

public:
/// Constructor of the LoanedMessage class.
/**
* The constructor of this class allocates memory for a given message type
Expand All @@ -57,7 +57,7 @@ class LoanedMessage
*/
LoanedMessage(
const rclcpp::PublisherBase & pub,
std::allocator<MessageT> allocator)
MessageAllocator allocator)
: pub_(pub),
message_(nullptr),
message_allocator_(std::move(allocator))
Expand Down

0 comments on commit 7e9ff5f

Please sign in to comment.