| 122 | } |
| 123 | |
| 124 | void insert(const std::string & word) { |
| 125 | size_t current = 0; |
| 126 | for (unsigned char ch : word) { |
| 127 | auto it = nodes[current].children.find(ch); |
| 128 | if (it == nodes[current].children.end()) { |
| 129 | size_t child = create_node(); |
| 130 | nodes[child].depth = nodes[current].depth + 1; |
| 131 | nodes[current].children[ch] = child; |
| 132 | current = child; |
| 133 | } else { |
| 134 | current = it->second; |
| 135 | } |
| 136 | } |
| 137 | nodes[current].is_word = true; |
| 138 | } |
| 139 | }; |
| 140 | |
| 141 | static std::pair<uint32_t, size_t> parse_hex_escape(const std::string & str, size_t pos, int hex_count) { |
no test coverage detected