From cba44900c4c8f87d1b4bd4bd5ddb3159bdba94d9 Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Mon, 16 Dec 2024 17:52:15 +0800 Subject: [PATCH] chore: remove the redundant `std::string` creation --- rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index dec1597a..988c9ffc 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -287,7 +287,6 @@ bool SubscriptionData::init() zenoh::Subscriber sub = context_impl->session()->declare_subscriber( sub_ke, [data_wp](const zenoh::Sample & sample) { - zenoh::KeyExpr keystr(std::string(sample.get_keyexpr().as_string_view())); auto sub_data = data_wp.lock(); if (sub_data == nullptr) { @@ -313,7 +312,7 @@ bool SubscriptionData::init() payload.as_vector(), std::chrono::system_clock::now().time_since_epoch().count(), std::move(attachment_data)), - std::string(keystr.as_string_view())); + std::string(sample.get_keyexpr().as_string_view())); }, zenoh::closures::none, std::move(sub_options),