MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / BuildSortByKey

Method BuildSortByKey

extern/imgui/imgui.cpp:2313–2326  ·  view source on GitHub ↗

For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.

Source from the content-addressed store, hash-verified

2311
2312// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
2313void ImGuiStorage::BuildSortByKey()
2314{
2315 struct StaticFunc
2316 {
2317 static int IMGUI_CDECL PairComparerByID(const void* lhs, const void* rhs)
2318 {
2319 // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
2320 if (((const ImGuiStoragePair*)lhs)->key > ((const ImGuiStoragePair*)rhs)->key) return +1;
2321 if (((const ImGuiStoragePair*)lhs)->key < ((const ImGuiStoragePair*)rhs)->key) return -1;
2322 return 0;
2323 }
2324 };
2325 ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairComparerByID);
2326}
2327
2328int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
2329{

Callers

nothing calls this directly

Calls 1

ImQsortFunction · 0.85

Tested by

no test coverage detected