From ebb4a98e71ee01957426c3e6fcefbd32389027ab Mon Sep 17 00:00:00 2001 From: Thomas Debrunner Date: Mon, 13 Nov 2023 17:00:01 +0100 Subject: [PATCH] ulog_info example: directly iterate over subscriptions --- examples/ulog_info.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/examples/ulog_info.cpp b/examples/ulog_info.cpp index c67886a..3d8f3f0 100644 --- a/examples/ulog_info.cpp +++ b/examples/ulog_info.cpp @@ -87,16 +87,9 @@ int main(int argc, char** argv) // Messages printf("\n"); printf("Name (multi id) - number of data points\n"); - - // Sort by name & multi id - const auto& subscriptions = data_container->subscriptionsByNameAndMultiId(); - std::vector sorted_subscription_keys( - subscriptions.size()); - std::transform(subscriptions.begin(), subscriptions.end(), sorted_subscription_keys.begin(), - [](const auto& pair) { return pair.first; }); - for (const auto& key : sorted_subscription_keys) { - const auto& subscription = subscriptions.at(key); - printf(" %s (%i) - %zu\n", key.name.c_str(), key.multi_id, subscription->size()); + for (const auto& item : data_container->subscriptionsByNameAndMultiId()) { + printf(" %s (%i) - %zu\n", item.first.name.c_str(), item.first.multi_id, + item.second->size()); } printf("Formats:\n");