std::lower_bound but without the bullshit
| 1871 | |
| 1872 | // std::lower_bound but without the bullshit |
| 1873 | static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key) |
| 1874 | { |
| 1875 | ImGuiStorage::ImGuiStoragePair* first = data.Data; |
| 1876 | ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; |
| 1877 | size_t count = (size_t)(last - first); |
| 1878 | while (count > 0) |
| 1879 | { |
| 1880 | size_t count2 = count >> 1; |
| 1881 | ImGuiStorage::ImGuiStoragePair* mid = first + count2; |
| 1882 | if (mid->key < key) |
| 1883 | { |
| 1884 | first = ++mid; |
| 1885 | count -= count2 + 1; |
| 1886 | } |
| 1887 | else |
| 1888 | { |
| 1889 | count = count2; |
| 1890 | } |
| 1891 | } |
| 1892 | return first; |
| 1893 | } |
| 1894 | |
| 1895 | // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. |
| 1896 | void ImGuiStorage::BuildSortByKey() |
no outgoing calls
no test coverage detected