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