MCPcopy Create free account
hub / github.com/TheRealMJP/DXRPathTracer / BuildSortByKey

Method BuildSortByKey

SampleFramework12/v1.02/ImGui/imgui.cpp:1718–1732  ·  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

1716
1717// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
1718void ImGuiStorage::BuildSortByKey()
1719{
1720 struct StaticFunc
1721 {
1722 static int IMGUI_CDECL PairCompareByID(const void* lhs, const void* rhs)
1723 {
1724 // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
1725 if (((const Pair*)lhs)->key > ((const Pair*)rhs)->key) return +1;
1726 if (((const Pair*)lhs)->key < ((const Pair*)rhs)->key) return -1;
1727 return 0;
1728 }
1729 };
1730 if (Data.Size > 1)
1731 ImQsort(Data.Data, (size_t)Data.Size, sizeof(Pair), StaticFunc::PairCompareByID);
1732}
1733
1734int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
1735{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected