Removing unnecessary string copies when iterating vectors and maps in KeyGraphFeaturesInfo (#915)

This commit is contained in:
Scott Freeman 2020-01-09 15:05:16 -05:00 committed by Matt Cooley
parent 6fe229fc15
commit 4f05b63ba6

View File

@ -20,7 +20,7 @@ IObservableVector<String ^> ^ KeyGraphFeaturesInfo::ConvertWStringVector(vector<
{ {
auto outVector = ref new Vector<String ^>(); auto outVector = ref new Vector<String ^>();
for (auto v : inVector) for (const auto& v : inVector)
{ {
outVector->Append(ref new String(v.c_str())); outVector->Append(ref new String(v.c_str()));
} }
@ -32,7 +32,7 @@ IObservableMap<String ^, String ^> ^ KeyGraphFeaturesInfo::ConvertWStringIntMap(
{ {
Map<String ^, String ^> ^ outMap = ref new Map<String ^, String ^>(); Map<String ^, String ^> ^ outMap = ref new Map<String ^, String ^>();
; ;
for (auto m : inMap) for (const auto& m : inMap)
{ {
outMap->Insert(ref new String(m.first.c_str()), m.second.ToString()); outMap->Insert(ref new String(m.first.c_str()), m.second.ToString());
} }