From 0d0f8635218a2893fcd00385019089253474f634 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Mon, 10 May 2021 08:05:45 -0400 Subject: add upstream 11.10 --- wx+/choice_enum.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'wx+/choice_enum.h') diff --git a/wx+/choice_enum.h b/wx+/choice_enum.h index a590861a..a25bf104 100644 --- a/wx+/choice_enum.h +++ b/wx+/choice_enum.h @@ -48,7 +48,7 @@ struct EnumDescrList using DescrList = std::vector>>; DescrList descrList; - std::unordered_map> itemsSetLast; + std::unordered_map> labelsSetLast; }; template void setEnumVal(const EnumDescrList& mapping, wxChoice& ctrl, Enum value); template Enum getEnumVal(const EnumDescrList& mapping, const wxChoice& ctrl); @@ -71,16 +71,16 @@ template void updateTooltipEnumVal(const EnumDescrList& mappi template void setEnumVal(EnumDescrList& mapping, wxChoice& ctrl, Enum value) { - auto& itemsSetLast = mapping.itemsSetLast[&ctrl]; + auto& labelsSetLast = mapping.labelsSetLast[&ctrl]; - std::vector items; - for (auto it = mapping.descrList.begin(); it != mapping.descrList.end(); ++it) - items.push_back(it->second.first); + std::vector labels; + for (const auto& [val, texts] : mapping.descrList) + labels.push_back(texts.first); - if (items != itemsSetLast) + if (labels != labelsSetLast) { - ctrl.Set(items); //expensive as fuck! => only call when absolutely needed! - itemsSetLast = std::move(items); + ctrl.Set(labels); //expensive as fuck! => only call when absolutely needed! + labelsSetLast = std::move(labels); } //----------------------------------------------------------------- -- cgit