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

Replace const char * with a std::array<char, TOPIC_NAME_LENGTH> as the key of IPM IDTopicMap #671

Merged
merged 7 commits into from
Apr 4, 2019
14 changes: 3 additions & 11 deletions rclcpp/include/rclcpp/intra_process_manager_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,19 +285,11 @@ class IntraProcessManagerImpl : public IntraProcessManagerImplBase
std::hash<uint64_t>, std::equal_to<uint64_t>,
RebindAlloc<std::pair<const uint64_t, SubscriptionBase::WeakPtr>>>;

struct strcmp_wrapper
{
bool
operator()(const char * lhs, const char * rhs) const
{
return std::strcmp(lhs, rhs) < 0;
}
};
using IDTopicMap = std::map<
const char *,
std::string,
AllocSet,
strcmp_wrapper,
RebindAlloc<std::pair<const char * const, AllocSet>>>;
std::less<std::string>,
RebindAlloc<std::pair<const std::string, AllocSet>>>;

SubscriptionMap subscriptions_;

Expand Down