From 3ed99b5cb2a32d1f6823d9e04ec9133454631c20 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 19 Apr 2014 19:23:47 -0700 Subject: [PATCH] Make SubsEditBox::PopulateList less pointlessly slow --- src/subs_edit_box.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/subs_edit_box.cpp b/src/subs_edit_box.cpp index 883fa843b..9fc8180ef 100644 --- a/src/subs_edit_box.cpp +++ b/src/subs_edit_box.cpp @@ -68,6 +68,15 @@ #include #include +namespace std { + template + struct hash> { + size_t operator()(boost::flyweight const& ss) const { + return hash()(&ss.get()); + } + }; +} + namespace { /// Work around wxGTK's fondness for generating events from ChangeValue @@ -340,7 +349,7 @@ void SubsEditBox::UpdateFields(int type, bool repopulate_lists) { void SubsEditBox::PopulateList(wxComboBox *combo, boost::flyweight AssDialogue::*field) { wxEventBlocker blocker(this); - std::unordered_set values; + std::unordered_set> values; for (auto const& line : c->ass->Events) { auto const& value = line.*field; if (!value.get().empty())