Skip to content

Commit

Permalink
Using size_t for levenshtein distance
Browse files Browse the repository at this point in the history
  • Loading branch information
p-ranav committed Nov 4, 2023
1 parent b43c0a7 commit ecccae5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,10 @@ std::string_view
get_most_similar_string(const std::map<std::string_view, ValueType> &map,
const std::string_view input) {
std::string_view most_similar{};
int min_distance = std::numeric_limits<int>::max();
std::size_t min_distance = std::numeric_limits<std::size_t>::max();

for (const auto &entry : map) {
int distance = get_levenshtein_distance(entry.first, input);
std::size_t distance = get_levenshtein_distance(entry.first, input);
if (distance < min_distance) {
min_distance = distance;
most_similar = entry.first;
Expand Down

0 comments on commit ecccae5

Please sign in to comment.