std::lower_bound but without the bullshit
| 2226 | |
| 2227 | // std::lower_bound but without the bullshit |
| 2228 | static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key) |
| 2229 | { |
| 2230 | ImGuiStorage::ImGuiStoragePair* first = data.Data; |
| 2231 | ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; |
| 2232 | size_t count = (size_t)(last - first); |
| 2233 | while (count > 0) |
| 2234 | { |
| 2235 | size_t count2 = count >> 1; |
| 2236 | ImGuiStorage::ImGuiStoragePair* mid = first + count2; |
| 2237 | if (mid->key < key) |
| 2238 | { |
| 2239 | first = ++mid; |
| 2240 | count -= count2 + 1; |
| 2241 | } |
| 2242 | else |
| 2243 | { |
| 2244 | count = count2; |
| 2245 | } |
| 2246 | } |
| 2247 | return first; |
| 2248 | } |
| 2249 | |
| 2250 | // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. |
| 2251 | void ImGuiStorage::BuildSortByKey() |
no outgoing calls
no test coverage detected