// Use a custom selection.Adapter: store item identifier in Selection (instead of index)
staticImVector<ImGuiID>items;
staticExampleSelectionWithDeletionselection;
selection.AdapterData=(void*)&items;
selection.AdapterIndexToStorageId=[](ImGuiSelectionBasicStorage*self,intidx){ImVector<ImGuiID>*p_items=(ImVector<ImGuiID>*)self->AdapterData;return(*p_items)[idx];};// Index -> ID
selection.UserData=(void*)&items;
selection.AdapterIndexToStorageId=[](ImGuiSelectionBasicStorage*self,intidx){ImVector<ImGuiID>*p_items=(ImVector<ImGuiID>*)self->UserData;return(*p_items)[idx];};// Index -> ID
ImGui::Text("Added features:");
ImGui::BulletText("Dynamic list with Delete key support.");
// Lifetime: don't hold on ImGuiMultiSelectIO* pointers over multiple frames or past any subsequent call to BeginMultiSelect() or EndMultiSelect().
// Passing 'current_selection_size' is currently optional:
// - it is useful for shortcut routing with ImGuiMultiSelectFlags_ClearOnEscape: so we can have Escape be used to clear selection THEN to exit child window.
// - if it is costly for you to compute, but can easily tell if your selection is empty or not, you may alter the ImGuiMultiSelectFlags_ClearOnEscape flag based on that.
// - if it is costly for you to compute, but can easily tell if your selection is empty or not, you may pass 1, or use the ImGuiMultiSelectFlags_ClearOnEscape flag dynamically.