From 301bafa3f5224a62187d017cc96a50d7acff58d8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 19 May 2020 12:15:28 -0700 Subject: [PATCH] Replace more Move/Forward with STL variants. --- core/CoreConfig.cpp | 2 +- core/MenuStyle_Base.cpp | 4 ++-- core/MenuStyle_Base.h | 9 +++++---- core/logic/GameConfigs.cpp | 4 ++-- core/logic/PluginSys.cpp | 4 ++-- core/logic/frame_tasks.cpp | 9 +++++---- core/logic/smn_adt_trie.cpp | 1 - core/logic/smn_database.cpp | 2 +- public/ReentrantList.h | 4 +++- public/amtl | 2 +- public/sm_stringhashmap.h | 10 ++++++---- 11 files changed, 28 insertions(+), 23 deletions(-) diff --git a/core/CoreConfig.cpp b/core/CoreConfig.cpp index c1fb80f1..77716cc5 100644 --- a/core/CoreConfig.cpp +++ b/core/CoreConfig.cpp @@ -291,7 +291,7 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value, } ke::AString vstr(value); - m_KeyValues.replace(option, ke::Move(vstr)); + m_KeyValues.replace(option, std::move(vstr)); return result; } diff --git a/core/MenuStyle_Base.cpp b/core/MenuStyle_Base.cpp index 398c2e0a..208d9cd6 100644 --- a/core/MenuStyle_Base.cpp +++ b/core/MenuStyle_Base.cpp @@ -640,7 +640,7 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw) item.display = std::make_unique(draw.display); item.style = draw.style; - m_items.append(ke::Move(item)); + m_items.append(std::move(item)); return true; } @@ -661,7 +661,7 @@ bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDr item.display = std::make_unique(draw.display); item.style = draw.style; - m_items.insert(position, ke::Move(item)); + m_items.insert(position, std::move(item)); return true; } diff --git a/core/MenuStyle_Base.h b/core/MenuStyle_Base.h index ea431de8..57844eaa 100644 --- a/core/MenuStyle_Base.h +++ b/core/MenuStyle_Base.h @@ -33,6 +33,7 @@ #define _INCLUDE_MENUSTYLE_BASE_H #include +#include #include #include @@ -51,16 +52,16 @@ public: access = 0; } CItem(CItem &&other) - : info(ke::Move(other.info)), - display(ke::Move(other.display)) + : info(std::move(other.info)), + display(std::move(other.display)) { style = other.style; access = other.access; } CItem & operator =(CItem &&other) { - info = ke::Move(other.info); - display = ke::Move(other.display); + info = std::move(other.info); + display = std::move(other.display); style = other.style; access = other.access; return *this; diff --git a/core/logic/GameConfigs.cpp b/core/logic/GameConfigs.cpp index aef5748d..da36719a 100644 --- a/core/logic/GameConfigs.cpp +++ b/core/logic/GameConfigs.cpp @@ -400,13 +400,13 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key } } else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) { ke::AString vstr(value); - m_Keys.replace(key, ke::Move(vstr)); + m_Keys.replace(key, std::move(vstr)); } else if (m_ParseState == PSTATE_GAMEDEFS_KEYS_PLATFORM) { if (IsPlatformCompatible(key, &matched_platform)) { ke::AString vstr(value); - m_Keys.replace(m_Key, ke::Move(vstr)); + m_Keys.replace(m_Key, std::move(vstr)); } } else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) { if (strcmp(key, "game") == 0) diff --git a/core/logic/PluginSys.cpp b/core/logic/PluginSys.cpp index b432824e..2b5029a8 100644 --- a/core/logic/PluginSys.cpp +++ b/core/logic/PluginSys.cpp @@ -1211,7 +1211,7 @@ void CPluginManager::LoadExtensions(CPlugin *pPlugin) } return true; }; - pPlugin->ForEachExtVar(ke::Move(callback)); + pPlugin->ForEachExtVar(std::move(callback)); } bool CPluginManager::RequireExtensions(CPlugin *pPlugin) @@ -1247,7 +1247,7 @@ bool CPluginManager::RequireExtensions(CPlugin *pPlugin) return true; }; - return pPlugin->ForEachExtVar(ke::Move(callback)); + return pPlugin->ForEachExtVar(std::move(callback)); } CPlugin *CPluginManager::CompileAndPrep(const char *path) diff --git a/core/logic/frame_tasks.cpp b/core/logic/frame_tasks.cpp index 0daf60ec..18d7ea96 100644 --- a/core/logic/frame_tasks.cpp +++ b/core/logic/frame_tasks.cpp @@ -26,6 +26,7 @@ // or . #include "frame_tasks.h" #include +#include using namespace SourceMod; @@ -35,7 +36,7 @@ ke::Vector> sWorkTasks; void SourceMod::ScheduleTaskForNextFrame(ke::Function&& task) { - sNextTasks.append(ke::Forward(task)); + sNextTasks.append(std::forward(task)); } void @@ -45,9 +46,9 @@ SourceMod::RunScheduledFrameTasks(bool simulating) return; // Swap. - ke::Vector> temp(ke::Move(sNextTasks)); - sNextTasks = ke::Move(sWorkTasks); - sWorkTasks = ke::Move(temp); + ke::Vector> temp(std::move(sNextTasks)); + sNextTasks = std::move(sWorkTasks); + sWorkTasks = std::move(temp); for (size_t i = 0; i < sWorkTasks.length(); i++) sWorkTasks[i](); diff --git a/core/logic/smn_adt_trie.cpp b/core/logic/smn_adt_trie.cpp index 9c4afe16..5a6d9e90 100644 --- a/core/logic/smn_adt_trie.cpp +++ b/core/logic/smn_adt_trie.cpp @@ -34,7 +34,6 @@ #include #include "common_logic.h" -#include #include #include #include "sm_memtable.h" diff --git a/core/logic/smn_database.cpp b/core/logic/smn_database.cpp index 834ec864..f0e7b0db 100644 --- a/core/logic/smn_database.cpp +++ b/core/logic/smn_database.cpp @@ -1540,7 +1540,7 @@ static cell_t SQL_AddQuery(IPluginContext *pContext, const cell_t *params) Transaction::Entry entry; entry.query = query; entry.data = params[3]; - txn->entries.append(ke::Move(entry)); + txn->entries.append(std::move(entry)); return cell_t(txn->entries.length() - 1); } diff --git a/public/ReentrantList.h b/public/ReentrantList.h index 74b2fbfd..fad52bba 100644 --- a/public/ReentrantList.h +++ b/public/ReentrantList.h @@ -27,6 +27,8 @@ #ifndef _include_sourcemod_reentrant_iterator_h_ #define _include_sourcemod_reentrant_iterator_h_ +#include + #include #include @@ -148,7 +150,7 @@ public: template void insertBefore(iterator& where, U &&obj) { - BaseType::insertBefore(where.impl_, ke::Forward(obj)); + BaseType::insertBefore(where.impl_, std::forward(obj)); } template diff --git a/public/amtl b/public/amtl index bf8516fd..5376e776 160000 --- a/public/amtl +++ b/public/amtl @@ -1 +1 @@ -Subproject commit bf8516fd43dd1f498e89e579ebd3b70a9041df09 +Subproject commit 5376e7763f31b8b284b536aaca3a4463e5f87e26 diff --git a/public/sm_stringhashmap.h b/public/sm_stringhashmap.h index 96e57e16..ea41d712 100644 --- a/public/sm_stringhashmap.h +++ b/public/sm_stringhashmap.h @@ -44,11 +44,13 @@ * NameHashSet instead. */ +#include + +#include + #include #include #include -#include -#include namespace SourceMod { @@ -163,7 +165,7 @@ public: if (!internal_.add(i, aKey)) return false; } - i->value = ke::Forward(value); + i->value = std::forward(value); return true; } @@ -174,7 +176,7 @@ public: Insert i = internal_.findForAdd(key); if (i.found()) return false; - if (!internal_.add(i, aKey, ke::Forward(value))) + if (!internal_.add(i, aKey, std::forward(value))) return false; memory_used_ += key.length() + 1; return true;