std::lower_bound but without the bullshit
| 2350 | |
| 2351 | // std::lower_bound but without the bullshit |
| 2352 | static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key) |
| 2353 | { |
| 2354 | ImGuiStorage::ImGuiStoragePair* first = data.Data; |
| 2355 | ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; |
| 2356 | size_t count = (size_t)(last - first); |
| 2357 | while (count > 0) |
| 2358 | { |
| 2359 | size_t count2 = count >> 1; |
| 2360 | ImGuiStorage::ImGuiStoragePair* mid = first + count2; |
| 2361 | if (mid->key < key) |
| 2362 | { |
| 2363 | first = ++mid; |
| 2364 | count -= count2 + 1; |
| 2365 | } |
| 2366 | else |
| 2367 | { |
| 2368 | count = count2; |
| 2369 | } |
| 2370 | } |
| 2371 | return first; |
| 2372 | } |
| 2373 | |
| 2374 | // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. |
| 2375 | void ImGuiStorage::BuildSortByKey() |
no outgoing calls
no test coverage detected