Replace more Move/Forward with STL variants.

This commit is contained in:
David Anderson 2020-05-19 12:15:28 -07:00
parent 7a3e4054c7
commit 301bafa3f5
11 changed files with 28 additions and 23 deletions

View File

@ -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;
}

View File

@ -640,7 +640,7 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
item.display = std::make_unique<ke::AString>(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<ke::AString>(draw.display);
item.style = draw.style;
m_items.insert(position, ke::Move(item));
m_items.insert(position, std::move(item));
return true;
}

View File

@ -33,6 +33,7 @@
#define _INCLUDE_MENUSTYLE_BASE_H
#include <memory>
#include <utility>
#include <IMenuManager.h>
#include <IPlayerHelpers.h>
@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -26,6 +26,7 @@
// or <http://www.sourcemod.net/license.php>.
#include "frame_tasks.h"
#include <am-vector.h>
#include <utility>
using namespace SourceMod;
@ -35,7 +36,7 @@ ke::Vector<ke::Function<void()>> sWorkTasks;
void
SourceMod::ScheduleTaskForNextFrame(ke::Function<void()>&& task)
{
sNextTasks.append(ke::Forward<decltype(task)>(task));
sNextTasks.append(std::forward<decltype(task)>(task));
}
void
@ -45,9 +46,9 @@ SourceMod::RunScheduledFrameTasks(bool simulating)
return;
// Swap.
ke::Vector<ke::Function<void()>> temp(ke::Move(sNextTasks));
sNextTasks = ke::Move(sWorkTasks);
sWorkTasks = ke::Move(temp);
ke::Vector<ke::Function<void()>> temp(std::move(sNextTasks));
sNextTasks = std::move(sWorkTasks);
sWorkTasks = std::move(temp);
for (size_t i = 0; i < sWorkTasks.length(); i++)
sWorkTasks[i]();

View File

@ -34,7 +34,6 @@
#include <memory>
#include "common_logic.h"
#include <am-moveable.h>
#include <am-refcounting.h>
#include <sm_stringhashmap.h>
#include "sm_memtable.h"

View File

@ -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);
}

View File

@ -27,6 +27,8 @@
#ifndef _include_sourcemod_reentrant_iterator_h_
#define _include_sourcemod_reentrant_iterator_h_
#include <utility>
#include <amtl/am-linkedlist.h>
#include <amtl/am-function.h>
@ -148,7 +150,7 @@ public:
template <typename U>
void insertBefore(iterator& where, U &&obj) {
BaseType::insertBefore(where.impl_, ke::Forward<U>(obj));
BaseType::insertBefore(where.impl_, std::forward<U>(obj));
}
template <typename U>

@ -1 +1 @@
Subproject commit bf8516fd43dd1f498e89e579ebd3b70a9041df09
Subproject commit 5376e7763f31b8b284b536aaca3a4463e5f87e26

View File

@ -44,11 +44,13 @@
* NameHashSet instead.
*/
#include <string.h>
#include <utility>
#include <am-allocator-policies.h>
#include <am-hashmap.h>
#include <am-string.h>
#include <am-moveable.h>
#include <string.h>
namespace SourceMod
{
@ -163,7 +165,7 @@ public:
if (!internal_.add(i, aKey))
return false;
}
i->value = ke::Forward<UV>(value);
i->value = std::forward<UV>(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<UV>(value)))
if (!internal_.add(i, aKey, std::forward<UV>(value)))
return false;
memory_used_ += key.length() + 1;
return true;