-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Description
Bug report
Required Info:
- Operating System:
- Linux
- Installation type:
- From source
- Version or commit hash:
- iron, jazzy, rolling
- DDS implementation:
- Fast-RTPS
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
The LoanedMessage class is defined with an AllocatorT template parameter which is used as the type for the message_allocator_ member variable:
template<typename MessageT, typename AllocatorT = std::allocator<void>>
class LoanedMessage
{
using MessageAllocatorTraits = rclcpp::allocator::AllocRebind<MessageT, AllocatorT>;
using MessageAllocator = typename MessageAllocatorTraits::allocator_type;
MessageAllocator message_allocator_;
};However, the constructor accepts an allocator parameter which is of type std::allocator<MessageT>:
LoanedMessage(
const rclcpp::PublisherBase & pub,
MessageAllocator allocator)
: pub_(pub),
message_(nullptr),
message_allocator_(std::move(allocator))
{
}This prevents creating instances of LoanedMessage when using a custom allocator which is not based on std::allocator. Our recommendation to resolve this issue is to modify the constructor to use MessageAllocator as the type for the allocator parameter:
LoanedMessage(
const rclcpp::PublisherBase & pub,
- std::allocator<MessageT> allocator)
+ MessageAllocator allocator)
: pub_(pub),
message_(nullptr),
message_allocator_(std::move(allocator))
{
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels