From af759683b863b8513704b67ed2c782da5e940582 Mon Sep 17 00:00:00 2001 From: Bo Svensson <90132211+bosvensson1@users.noreply.github.com> Date: Sun, 10 Oct 2021 16:15:40 +0000 Subject: [PATCH] enables std::move in keywordsearch.hpp (#3163) For some reason we have commented std::move keywords in keywordsearch.hpp while they are quite beneficial. openmw_test_suite for keywordsearch.hpp takes 30% less time with these changes. --- apps/openmw/mwdialogue/keywordsearch.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwdialogue/keywordsearch.hpp b/apps/openmw/mwdialogue/keywordsearch.hpp index 0c14ea8f8d..39599457ef 100644 --- a/apps/openmw/mwdialogue/keywordsearch.hpp +++ b/apps/openmw/mwdialogue/keywordsearch.hpp @@ -30,7 +30,7 @@ public: { if (keyword.empty()) return; - seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), 0, mRoot); + seed_impl (std::move(keyword), std::move (value), 0, mRoot); } void clear () @@ -39,7 +39,7 @@ public: mRoot.mKeyword.clear (); } - bool containsKeyword (string_t keyword, value_t& value) + bool containsKeyword (const string_t& keyword, value_t& value) { typename Entry::childen_t::iterator current; typename Entry::childen_t::iterator next; @@ -209,8 +209,8 @@ private: if (j == entry.mChildren.end ()) { - entry.mChildren [ch].mValue = /*std::move*/ (value); - entry.mChildren [ch].mKeyword = /*std::move*/ (keyword); + entry.mChildren [ch].mValue = std::move (value); + entry.mChildren [ch].mKeyword = std::move (keyword); } else { @@ -219,22 +219,22 @@ private: if (keyword == j->second.mKeyword) throw std::runtime_error ("duplicate keyword inserted"); - value_t pushValue = /*std::move*/ (j->second.mValue); - string_t pushKeyword = /*std::move*/ (j->second.mKeyword); + value_t pushValue = j->second.mValue; + string_t pushKeyword = j->second.mKeyword; if (depth >= pushKeyword.size ()) throw std::runtime_error ("unexpected"); if (depth+1 < pushKeyword.size()) { - seed_impl (/*std::move*/ (pushKeyword), /*std::move*/ (pushValue), depth+1, j->second); + seed_impl (std::move (pushKeyword), std::move (pushValue), depth+1, j->second); j->second.mKeyword.clear (); } } if (depth+1 == keyword.size()) j->second.mKeyword = value; else // depth+1 < keyword.size() - seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), depth+1, j->second); + seed_impl (std::move (keyword), std::move (value), depth+1, j->second); } }