Replace more Move/Forward with STL variants.
This commit is contained in:
parent
7a3e4054c7
commit
301bafa3f5
@ -291,7 +291,7 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ke::AString vstr(value);
|
ke::AString vstr(value);
|
||||||
m_KeyValues.replace(option, ke::Move(vstr));
|
m_KeyValues.replace(option, std::move(vstr));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
|
|||||||
item.display = std::make_unique<ke::AString>(draw.display);
|
item.display = std::make_unique<ke::AString>(draw.display);
|
||||||
item.style = draw.style;
|
item.style = draw.style;
|
||||||
|
|
||||||
m_items.append(ke::Move(item));
|
m_items.append(std::move(item));
|
||||||
return true;
|
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.display = std::make_unique<ke::AString>(draw.display);
|
||||||
item.style = draw.style;
|
item.style = draw.style;
|
||||||
|
|
||||||
m_items.insert(position, ke::Move(item));
|
m_items.insert(position, std::move(item));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#define _INCLUDE_MENUSTYLE_BASE_H
|
#define _INCLUDE_MENUSTYLE_BASE_H
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <IMenuManager.h>
|
#include <IMenuManager.h>
|
||||||
#include <IPlayerHelpers.h>
|
#include <IPlayerHelpers.h>
|
||||||
@ -51,16 +52,16 @@ public:
|
|||||||
access = 0;
|
access = 0;
|
||||||
}
|
}
|
||||||
CItem(CItem &&other)
|
CItem(CItem &&other)
|
||||||
: info(ke::Move(other.info)),
|
: info(std::move(other.info)),
|
||||||
display(ke::Move(other.display))
|
display(std::move(other.display))
|
||||||
{
|
{
|
||||||
style = other.style;
|
style = other.style;
|
||||||
access = other.access;
|
access = other.access;
|
||||||
}
|
}
|
||||||
CItem & operator =(CItem &&other)
|
CItem & operator =(CItem &&other)
|
||||||
{
|
{
|
||||||
info = ke::Move(other.info);
|
info = std::move(other.info);
|
||||||
display = ke::Move(other.display);
|
display = std::move(other.display);
|
||||||
style = other.style;
|
style = other.style;
|
||||||
access = other.access;
|
access = other.access;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -400,13 +400,13 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
|||||||
}
|
}
|
||||||
} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
|
} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
|
||||||
ke::AString vstr(value);
|
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) {
|
else if (m_ParseState == PSTATE_GAMEDEFS_KEYS_PLATFORM) {
|
||||||
if (IsPlatformCompatible(key, &matched_platform))
|
if (IsPlatformCompatible(key, &matched_platform))
|
||||||
{
|
{
|
||||||
ke::AString vstr(value);
|
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) {
|
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
||||||
if (strcmp(key, "game") == 0)
|
if (strcmp(key, "game") == 0)
|
||||||
|
@ -1211,7 +1211,7 @@ void CPluginManager::LoadExtensions(CPlugin *pPlugin)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
pPlugin->ForEachExtVar(ke::Move(callback));
|
pPlugin->ForEachExtVar(std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPluginManager::RequireExtensions(CPlugin *pPlugin)
|
bool CPluginManager::RequireExtensions(CPlugin *pPlugin)
|
||||||
@ -1247,7 +1247,7 @@ bool CPluginManager::RequireExtensions(CPlugin *pPlugin)
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
return pPlugin->ForEachExtVar(ke::Move(callback));
|
return pPlugin->ForEachExtVar(std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlugin *CPluginManager::CompileAndPrep(const char *path)
|
CPlugin *CPluginManager::CompileAndPrep(const char *path)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
// or <http://www.sourcemod.net/license.php>.
|
// or <http://www.sourcemod.net/license.php>.
|
||||||
#include "frame_tasks.h"
|
#include "frame_tasks.h"
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ ke::Vector<ke::Function<void()>> sWorkTasks;
|
|||||||
void
|
void
|
||||||
SourceMod::ScheduleTaskForNextFrame(ke::Function<void()>&& task)
|
SourceMod::ScheduleTaskForNextFrame(ke::Function<void()>&& task)
|
||||||
{
|
{
|
||||||
sNextTasks.append(ke::Forward<decltype(task)>(task));
|
sNextTasks.append(std::forward<decltype(task)>(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -45,9 +46,9 @@ SourceMod::RunScheduledFrameTasks(bool simulating)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Swap.
|
// Swap.
|
||||||
ke::Vector<ke::Function<void()>> temp(ke::Move(sNextTasks));
|
ke::Vector<ke::Function<void()>> temp(std::move(sNextTasks));
|
||||||
sNextTasks = ke::Move(sWorkTasks);
|
sNextTasks = std::move(sWorkTasks);
|
||||||
sWorkTasks = ke::Move(temp);
|
sWorkTasks = std::move(temp);
|
||||||
|
|
||||||
for (size_t i = 0; i < sWorkTasks.length(); i++)
|
for (size_t i = 0; i < sWorkTasks.length(); i++)
|
||||||
sWorkTasks[i]();
|
sWorkTasks[i]();
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
#include <am-moveable.h>
|
|
||||||
#include <am-refcounting.h>
|
#include <am-refcounting.h>
|
||||||
#include <sm_stringhashmap.h>
|
#include <sm_stringhashmap.h>
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
|
@ -1540,7 +1540,7 @@ static cell_t SQL_AddQuery(IPluginContext *pContext, const cell_t *params)
|
|||||||
Transaction::Entry entry;
|
Transaction::Entry entry;
|
||||||
entry.query = query;
|
entry.query = query;
|
||||||
entry.data = params[3];
|
entry.data = params[3];
|
||||||
txn->entries.append(ke::Move(entry));
|
txn->entries.append(std::move(entry));
|
||||||
|
|
||||||
return cell_t(txn->entries.length() - 1);
|
return cell_t(txn->entries.length() - 1);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#ifndef _include_sourcemod_reentrant_iterator_h_
|
#ifndef _include_sourcemod_reentrant_iterator_h_
|
||||||
#define _include_sourcemod_reentrant_iterator_h_
|
#define _include_sourcemod_reentrant_iterator_h_
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <amtl/am-linkedlist.h>
|
#include <amtl/am-linkedlist.h>
|
||||||
#include <amtl/am-function.h>
|
#include <amtl/am-function.h>
|
||||||
|
|
||||||
@ -148,7 +150,7 @@ public:
|
|||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
void insertBefore(iterator& where, U &&obj) {
|
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>
|
template <typename U>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit bf8516fd43dd1f498e89e579ebd3b70a9041df09
|
Subproject commit 5376e7763f31b8b284b536aaca3a4463e5f87e26
|
@ -44,11 +44,13 @@
|
|||||||
* NameHashSet instead.
|
* NameHashSet instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <am-allocator-policies.h>
|
#include <am-allocator-policies.h>
|
||||||
#include <am-hashmap.h>
|
#include <am-hashmap.h>
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
#include <am-moveable.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
namespace SourceMod
|
namespace SourceMod
|
||||||
{
|
{
|
||||||
@ -163,7 +165,7 @@ public:
|
|||||||
if (!internal_.add(i, aKey))
|
if (!internal_.add(i, aKey))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
i->value = ke::Forward<UV>(value);
|
i->value = std::forward<UV>(value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +176,7 @@ public:
|
|||||||
Insert i = internal_.findForAdd(key);
|
Insert i = internal_.findForAdd(key);
|
||||||
if (i.found())
|
if (i.found())
|
||||||
return false;
|
return false;
|
||||||
if (!internal_.add(i, aKey, ke::Forward<UV>(value)))
|
if (!internal_.add(i, aKey, std::forward<UV>(value)))
|
||||||
return false;
|
return false;
|
||||||
memory_used_ += key.length() + 1;
|
memory_used_ += key.length() + 1;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user