9 const std::string &
string,
10 std::size_t allowed_errors)
12 const std::size_t layer_offset =
string.size() + 1;
13 for(std::size_t i = 0; i <= allowed_errors; ++i)
15 final_states.push_back(
string.size() + layer_offset * i);
17 for(std::size_t string_index = 0; string_index <
string.size();
20 for(std::size_t error_layer = 0; error_layer <= allowed_errors;
25 error_layer * layer_offset + string_index,
27 error_layer * layer_offset + string_index + 1);
28 if(error_layer < allowed_errors)
32 error_layer * layer_offset + string_index,
33 (error_layer + 1) * layer_offset + string_index);
35 error_layer * layer_offset + string_index,
36 (error_layer + 1) * layer_offset + string_index + 1);
38 error_layer * layer_offset + string_index,
39 (error_layer + 1) * layer_offset + string_index + 1);
43 for(std::size_t error_layer = 0; error_layer < allowed_errors; ++error_layer)
47 error_layer * layer_offset +
string.size(),
48 (error_layer + 1) * layer_offset +
string.size());
61 for(
const auto c :
string)
65 for(std::size_t distance = 0; distance <
final_states.size(); ++distance)