C++ Utilities  5.10.5
Useful C++ classes and routines such as argument parser, IO and conversion utilities
levenshtein.h
Go to the documentation of this file.
1 #ifndef CPP_UTILITIES_LEVENSHTEIN_H
2 #define CPP_UTILITIES_LEVENSHTEIN_H
3 
4 #include "../global.h"
5 
6 #include <cstring>
7 #include <string>
8 
9 namespace CppUtilities {
10 
11 CPP_UTILITIES_EXPORT std::size_t computeDamerauLevenshteinDistance(const char *str1, std::size_t size1, const char *str2, std::size_t size2);
12 
13 inline std::size_t computeDamerauLevenshteinDistance(const std::string &str1, const std::string &str2)
14 {
15  return computeDamerauLevenshteinDistance(str1.data(), str1.size(), str2.data(), str2.size());
16 }
17 
18 inline std::size_t computeDamerauLevenshteinDistance(const char *str1, const char *str2)
19 {
20  return computeDamerauLevenshteinDistance(str1, std::strlen(str1), str2, std::strlen(str2));
21 }
22 
23 } // namespace CppUtilities
24 
25 #endif // CPP_UTILITIES_LEVENSHTEIN_H
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
Contains all utilities provides by the c++utilities library.
CPP_UTILITIES_EXPORT std::size_t computeDamerauLevenshteinDistance(const char *str1, std::size_t size1, const char *str2, std::size_t size2)