C++ Utilities: misc/levenshtein.h Source File

C++ Utilities 5.34.0 Useful C++ classes and routines such as argument parser, IO and conversion utilities

Loading...
Searching...
No Matches
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
9namespace 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
global.h
CPP_UTILITIES_EXPORT
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
Definition global.h:14
CppUtilities
Contains all utilities provided by the c++utilities library.
Definition argumentparser.h:18
CppUtilities::computeDamerauLevenshteinDistance
CPP_UTILITIES_EXPORT std::size_t computeDamerauLevenshteinDistance(const char *str1, std::size_t size1, const char *str2, std::size_t size2)