std::lower_bound but without the bullshit
| 1810 | |
| 1811 | // std::lower_bound but without the bullshit |
| 1812 | static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key) |
| 1813 | { |
| 1814 | ImGuiStorage::ImGuiStoragePair* first = data.Data; |
| 1815 | ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; |
| 1816 | size_t count = (size_t)(last - first); |
| 1817 | while (count > 0) |
| 1818 | { |
| 1819 | size_t count2 = count >> 1; |
| 1820 | ImGuiStorage::ImGuiStoragePair* mid = first + count2; |
| 1821 | if (mid->key < key) |
| 1822 | { |
| 1823 | first = ++mid; |
| 1824 | count -= count2 + 1; |
| 1825 | } |
| 1826 | else |
| 1827 | { |
| 1828 | count = count2; |
| 1829 | } |
| 1830 | } |
| 1831 | return first; |
| 1832 | } |
| 1833 | |
| 1834 | // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. |
| 1835 | void ImGuiStorage::BuildSortByKey() |
no outgoing calls
no test coverage detected