10 #ifndef STRINGUTILS_HPP_ 11 #define STRINGUTILS_HPP_ 18 namespace StringUtils {
20 template <
typename Container>
21 std::enable_if_t<!(EA::is_pointer<typename Container::value_type>::value), std::string>
23 std::size_t minDist = std::numeric_limits<std::size_t>::max();
24 typename Container::const_iterator mostSimilarIter;
25 for (
auto stringIter = cont.begin(); stringIter != cont.end(); ++stringIter) {
28 mostSimilarIter = stringIter;
36 return *mostSimilarIter;
39 template <
typename Container>
40 std::enable_if_t<EA::is_pointer<typename Container::value_type>::value, std::string>
42 std::size_t minDist = std::numeric_limits<std::size_t>::max();
43 typename Container::const_iterator mostSimilarIter;
44 for (
auto stringIter = cont.begin(); stringIter != cont.end(); ++stringIter) {
47 mostSimilarIter = stringIter;
55 return *(*mostSimilarIter);
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
std::size_t levenshtein(Iterator1 a, Iterator1 aEnd, Iterator2 b, Iterator2 bEnd)
Definition: levenshtein-sse.hpp:984
std::enable_if_t<!(is_pointer< typename Container::value_type >::value), std::string > FindSimilar(const std::string &str, const Container &cont)
Find a similar string inside a container.
Definition: StringUtils.hpp:22