File tree 5 files changed +7
-14
lines changed
5 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,7 @@ const CiffComponent::UniquePtr& CiffEntry::doAdd(UniquePtr /*component*/) {
134
134
} // CiffEntry::doAdd
135
135
136
136
const CiffComponent::UniquePtr& CiffDirectory::doAdd (UniquePtr component) {
137
- components_.push_back (std::move (component));
138
- return components_.back ();
137
+ return components_.emplace_back (std::move (component));
139
138
} // CiffDirectory::doAdd
140
139
141
140
void CiffHeader::read (const byte* pData, size_t size) {
Original file line number Diff line number Diff line change @@ -443,8 +443,7 @@ Exifdatum& ExifData::operator[](const std::string& key) {
443
443
ExifKey exifKey (key);
444
444
auto pos = findKey (exifKey);
445
445
if (pos == end ()) {
446
- exifMetadata_.emplace_back (exifKey);
447
- return exifMetadata_.back ();
446
+ return exifMetadata_.emplace_back (exifKey);
448
447
}
449
448
return *pos;
450
449
}
Original file line number Diff line number Diff line change @@ -209,8 +209,7 @@ Iptcdatum& IptcData::operator[](const std::string& key) {
209
209
IptcKey iptcKey (key);
210
210
auto pos = findKey (iptcKey);
211
211
if (pos == end ()) {
212
- iptcMetadata_.emplace_back (iptcKey);
213
- return iptcMetadata_.back ();
212
+ return iptcMetadata_.emplace_back (iptcKey);
214
213
}
215
214
return *pos;
216
215
}
Original file line number Diff line number Diff line change @@ -551,17 +551,15 @@ TiffComponent* TiffComponent::doAddChild(UniquePtr /*tiffComponent*/) {
551
551
} // TiffComponent::doAddChild
552
552
553
553
TiffComponent* TiffDirectory::doAddChild (TiffComponent::UniquePtr tiffComponent) {
554
- components_.push_back (std::move (tiffComponent));
555
- return components_.back ().get ();
554
+ return components_.emplace_back (std::move (tiffComponent)).get ();
556
555
} // TiffDirectory::doAddChild
557
556
558
557
TiffComponent* TiffSubIfd::doAddChild (TiffComponent::UniquePtr tiffComponent) {
559
558
auto d = dynamic_cast <TiffDirectory*>(tiffComponent.release ());
560
559
if (!d) {
561
560
throw Error (ErrorCode::kerErrorMessage, " dynamic_cast to TiffDirectory failed" );
562
561
}
563
- ifds_.emplace_back (d);
564
- return d;
562
+ return ifds_.emplace_back (d).get ();
565
563
} // TiffSubIfd::doAddChild
566
564
567
565
TiffComponent* TiffMnEntry::doAddChild (TiffComponent::UniquePtr tiffComponent) {
@@ -576,9 +574,8 @@ TiffComponent* TiffIfdMakernote::doAddChild(TiffComponent::UniquePtr tiffCompone
576
574
}
577
575
578
576
TiffComponent* TiffBinaryArray::doAddChild (TiffComponent::UniquePtr tiffComponent) {
579
- elements_.push_back (std::move (tiffComponent));
580
577
setDecoded (true );
581
- return elements_.back ( ).get ();
578
+ return elements_.emplace_back ( std::move (tiffComponent) ).get ();
582
579
} // TiffBinaryArray::doAddChild
583
580
584
581
TiffComponent* TiffComponent::addNext (TiffComponent::UniquePtr tiffComponent) {
Original file line number Diff line number Diff line change @@ -421,8 +421,7 @@ Xmpdatum& XmpData::operator[](const std::string& key) {
421
421
XmpKey xmpKey (key);
422
422
auto pos = findKey (xmpKey);
423
423
if (pos == end ()) {
424
- xmpMetadata_.emplace_back (xmpKey);
425
- return xmpMetadata_.back ();
424
+ return xmpMetadata_.emplace_back (xmpKey);
426
425
}
427
426
return *pos;
428
427
}
You can’t perform that action at this time.
0 commit comments