From 3eddbc493624a03b2472db4754fca8a32001c8ac Mon Sep 17 00:00:00 2001 From: nullptr Date: Sat, 7 Dec 2024 10:11:50 +0000 Subject: [PATCH] fix: pfld results uses forward list --- src/SSCMA_Micro_Core.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/SSCMA_Micro_Core.cpp b/src/SSCMA_Micro_Core.cpp index a809840..0853422 100644 --- a/src/SSCMA_Micro_Core.cpp +++ b/src/SSCMA_Micro_Core.cpp @@ -345,9 +345,8 @@ SSCMAMicroCore::Expected SSCMAMicroCore::invoke(const Frame& frame, const Invoke } auto results = algorithm->getResults(); if (_config.invoke_config && _config.invoke_config->top_k > 0) { - std::sort(results.begin(), results.end(), [](const ma_point_t& a, const ma_point_t& b) { return a.score > b.score; }); - results.resize(std::min(results.size(), static_cast(_config.invoke_config->top_k))); - results.shrink_to_fit(); + results.sort([](const ma_point_t& a, const ma_point_t& b) { return a.score < b.score; }); + results.resize(_config.invoke_config->top_k); } std::vector points; for (const auto& result : results) {