Error when compiling and using extract function #65
|
Hello, I discovered this library because I need fuzzy search in my program. I have the case that I am comparing one string against a multiple string, so I am using the extract function as shown in the readme: template <typename Sentence1,
typename Iterable, typename Sentence2 = typename Iterable::value_type>
std::vector<std::pair<Sentence2, double>>
extract(const Sentence1& query, const Iterable& choices, const double score_cutoff = 0.0)
{
std::vector<std::pair<Sentence2, double>> results;
rapidfuzz::fuzz::CachedRatio<typename Sentence1::value_type> scorer(query);
for (const auto& choice : choices) {
double score = scorer.similarity(choice, score_cutoff);
if (score >= score_cutoff) {
results.emplace_back(choice, score);
}
}
return results;
}I am using it like this: auto search_results = extract<std::string, std::vector<std::string>>(query, terms);However, I encouter this compilation error: Here are my build informations: I tried using a non-templated version, but I still get this error. Any idea on how to resolve this ? Thank you |
Answered by
maxbachmann
Mar 23, 2022
Replies: 4 comments
|
Seeing your error message, you are indeed using the older example code. |
0 replies
Forgot to enable them on the msvc compiler, where |
0 replies
|
Thank you, the fix 0000f4e along with @maxbachmann answer work. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you sure that you are already using the docs fix from: b23c9ad
Note that with C++20 it would be enough to use:
since I provide template deduction guides