File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
aws-cpp-sdk-core/source/client
aws-cpp-sdk-text-to-speech/source/text-to-speech Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -196,8 +196,9 @@ Aws::Vector<Aws::String> calculateAuthPreferences() {
196196 Aws::Vector<Aws::String> res;
197197 auto prefs = Aws::Environment::GetEnv (" AWS_AUTH_SCHEME_PREFERENCE" );
198198 Aws::Vector<Aws::String> prefsList = Aws::Utils::StringUtils::Split (prefs, ' ,' );
199+ res.reserve (prefsList.size ()); // avoid repeated allocations
199200 for (auto & pref : prefsList) {
200- res.push_back (Aws::Utils::StringUtils::Trim (pref.c_str ()));
201+ res.emplace_back (Aws::Utils::StringUtils::Trim (pref.c_str ()));
201202 }
202203 return res;
203204}
Original file line number Diff line number Diff line change @@ -93,8 +93,7 @@ namespace Aws
9393 for (auto & deviceInfo : driver->EnumerateDevices ())
9494 {
9595 AWS_LOGSTREAM_DEBUG (CLASS_TAG, " Adding device " << deviceInfo.deviceName << " for driver " << driver->GetName ());
96- OutputDevicePair device (deviceInfo, driver);
97- deviceDriverList.push_back (device);
96+ deviceDriverList.emplace_back (deviceInfo, driver);
9897 }
9998 }
10099
@@ -120,9 +119,11 @@ namespace Aws
120119 auto voicesOutcome = m_pollyClient->DescribeVoices (describeVoices);
121120 if (voicesOutcome.IsSuccess ())
122121 {
123- for (auto & voice : voicesOutcome.GetResult ().GetVoices ())
122+ auto & voices = voicesOutcome.GetResult ().GetVoices ();
123+ m_voices.reserve (voices.size ());
124+ for (const auto & voice : voices)
124125 {
125- m_voices.push_back (std::pair<Aws::String, Aws::String>( voice.GetName (), voice.GetLanguageName () ));
126+ m_voices.emplace_back ( voice.GetName (), voice.GetLanguageName ());
126127 }
127128 }
128129 else
You can’t perform that action at this time.
0 commit comments