fix loop | by Perplex
This commit is contained in:
parent
84f6fb2c70
commit
7508ce6d0d
|
@ -45,9 +45,8 @@ int main(int argc, char* argv[]) {
|
||||||
const auto trie = xcdat::load<xcdat::trie_15_type>(dict_file);
|
const auto trie = xcdat::load<xcdat::trie_15_type>(dict_file);
|
||||||
|
|
||||||
std::vector<std::string> substrings;
|
std::vector<std::string> substrings;
|
||||||
|
std::vector<Entry> results;
|
||||||
while (!search_string.empty()) {
|
while (!search_string.empty()) {
|
||||||
std::vector<Entry> results;
|
|
||||||
auto itr = trie.make_prefix_iterator(search_string);
|
auto itr = trie.make_prefix_iterator(search_string);
|
||||||
|
|
||||||
while (itr.next()) {
|
while (itr.next()) {
|
||||||
|
@ -79,9 +78,13 @@ int main(int argc, char* argv[]) {
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
search_string.erase(0, pos + smallest_prefix.length());
|
search_string.erase(0, pos + smallest_prefix.length());
|
||||||
}
|
}
|
||||||
|
else break;
|
||||||
|
|
||||||
std::cout << search_string << std::endl;
|
std::cout << search_string << std::endl;
|
||||||
|
|
||||||
|
if (smallest_prefix.length() == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
if (debug_mode) {
|
if (debug_mode) {
|
||||||
raw_output += search_string + '\n';
|
raw_output += search_string + '\n';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue