From 293d19cf137d6f3c28dff446b3c6dab8bfac5c05 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 26 Oct 2019 21:19:54 -0400 Subject: [PATCH] CCharLayoutInfo: std::move std::string instance in CCharLayoutInfo constructor Avoids performing a copy (and by extension also avoids redundant allocations). --- Runtime/Character/CCharLayoutInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Runtime/Character/CCharLayoutInfo.cpp b/Runtime/Character/CCharLayoutInfo.cpp index 3273e6917..29c69173f 100644 --- a/Runtime/Character/CCharLayoutInfo.cpp +++ b/Runtime/Character/CCharLayoutInfo.cpp @@ -48,10 +48,11 @@ CCharLayoutNode::CCharLayoutNode(CInputStream& in) : x0_boneMap(in.readUint32Big } CCharLayoutInfo::CCharLayoutInfo(CInputStream& in) : x0_node(std::make_shared(in)), x8_segIdList(in) { - atUint32 mapCount = in.readUint32Big(); + const atUint32 mapCount = in.readUint32Big(); + for (atUint32 i = 0; i < mapCount; ++i) { std::string key = in.readString(); - x18_segIdMap.emplace(key, in); + x18_segIdMap.emplace(std::move(key), in); } }