This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
VectorSearch/linear_finder.cpp

18 lines
426 B
C++

#include "linear_finder.h"
LinearFinder::LinearFinder(const vector<string> &word_list)
: word_list_(word_list) {}
vector<const string *>
LinearFinder::find_prefix(string_view search_term) const {
vector<const string *> matching_words;
for (const auto &current_word : word_list_) {
if (current_word.starts_with(search_term)) {
matching_words.push_back(&current_word);
}
}
return matching_words;
}