From b43c0a7e8344a08e8c805c43433599310fc9c740 Mon Sep 17 00:00:00 2001 From: Pranav Srinivas Kumar Date: Sat, 4 Nov 2023 15:46:41 -0500 Subject: [PATCH] Addressed clang-tidy issues --- include/argparse/argparse.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index d32d2e8..efbf3c4 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -454,12 +454,13 @@ template struct IsChoiceTypeSupported { }; template -int get_levenshtein_distance(const StringType &s1, const StringType &s2) { - std::vector> dp(s1.size() + 1, - std::vector(s2.size() + 1, 0)); +std::size_t get_levenshtein_distance(const StringType &s1, + const StringType &s2) { + std::vector> dp( + s1.size() + 1, std::vector(s2.size() + 1, 0)); - for (int i = 0; i <= s1.size(); ++i) { - for (int j = 0; j <= s2.size(); ++j) { + for (std::size_t i = 0; i <= s1.size(); ++i) { + for (std::size_t j = 0; j <= s2.size(); ++j) { if (i == 0) { dp[i][j] = j; } else if (j == 0) { @@ -1420,9 +1421,9 @@ public: m_subparser_used.insert_or_assign(it->get().m_program_name, false); } - for (auto &g : other.m_mutually_exclusive_groups) { + for (const auto &g : other.m_mutually_exclusive_groups) { MutuallyExclusiveGroup group(*this, g.m_required); - for (auto &arg : g.m_elements) { + for (const auto &arg : g.m_elements) { // Find argument in argument map and add reference to it // in new group // argument_it = other.m_argument_map.find("name")