| 137 | } |
| 138 | |
| 139 | void insert(const T &e, bool fRehash = false) |
| 140 | { |
| 141 | if (!fRehash) |
| 142 | RehashStep(); |
| 143 | |
| 144 | auto idx = idxFromObj(static_cast<T_KEY>(e)); |
| 145 | if (!fRehash) |
| 146 | ++celem; |
| 147 | |
| 148 | if (m_data[idx] == nullptr) |
| 149 | m_data[idx] = std::make_shared<vector_type>(); |
| 150 | |
| 151 | typename vector_type::iterator itrInsert; |
| 152 | if (!m_data[idx]->empty() && !(e < m_data[idx]->back())) |
| 153 | itrInsert = m_data[idx]->end(); |
| 154 | else |
| 155 | itrInsert = std::upper_bound(m_data[idx]->begin(), m_data[idx]->end(), e); |
| 156 | itrInsert = m_data[idx]->insert(itrInsert, e); |
| 157 | |
| 158 | if (celem > ((1ULL << bits)*targetElementsPerBucket())) |
| 159 | grow(); |
| 160 | } |
| 161 | |
| 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> |