std::lower_bound but without the bullshit
| 2292 | |
| 2293 | // std::lower_bound but without the bullshit |
| 2294 | static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key) |
| 2295 | { |
| 2296 | ImGuiStorage::ImGuiStoragePair* first = data.Data; |
| 2297 | ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; |
| 2298 | size_t count = (size_t)(last - first); |
| 2299 | while (count > 0) |
| 2300 | { |
| 2301 | size_t count2 = count >> 1; |
| 2302 | ImGuiStorage::ImGuiStoragePair* mid = first + count2; |
| 2303 | if (mid->key < key) |
| 2304 | { |
| 2305 | first = ++mid; |
| 2306 | count -= count2 + 1; |
| 2307 | } |
| 2308 | else |
| 2309 | { |
| 2310 | count = count2; |
| 2311 | } |
| 2312 | } |
| 2313 | return first; |
| 2314 | } |
| 2315 | |
| 2316 | // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. |
| 2317 | void ImGuiStorage::BuildSortByKey() |
no outgoing calls
no test coverage detected