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