| 162 | // enumeration starting from the 'itrStart'th key. Note that the iter is a hint, and need no be valid anymore |
| 163 | template<typename T_VISITOR, typename T_MAX> |
| 164 | setiter enumerate(const setiter &itrStart, const T_MAX &max, T_VISITOR fn, long long *pccheck) |
| 165 | { |
| 166 | setiter itr(itrStart); |
| 167 | |
| 168 | if (itrStart.set != this) // really if this case isn't true its probably a bug |
| 169 | itr.set = this; // but why crash the program when we can easily fix this? |
| 170 | |
| 171 | cfPauseRehash++; |
| 172 | if (itr.idxPrimary >= m_data.size()) |
| 173 | itr.idxPrimary = 0; |
| 174 | |
| 175 | for (size_t ibucket = 0; ibucket < m_data.size(); ++ibucket) |
| 176 | { |
| 177 | if (!enumerate_bucket(itr, max, fn, pccheck)) |
| 178 | break; |
| 179 | itr.idxSecondary = 0; |
| 180 | |
| 181 | ++itr.idxPrimary; |
| 182 | if (itr.idxPrimary >= m_data.size()) |
| 183 | itr.idxPrimary = 0; |
| 184 | } |
| 185 | cfPauseRehash--; |
| 186 | return itr; |
| 187 | } |
| 188 | |
| 189 | // This will "randomly" visit nodes biased towards lower values first |
| 190 | template<typename T_VISITOR> |