Skip to content

Commit

Permalink
use more emplace_back
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Aug 18, 2021
1 parent f3fcffd commit e7eddfc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions samples/Jzon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,11 @@ namespace Jzon

void Object::Add(const std::string &name, Node &node)
{
children.push_back(NamedNodePtr(name, node.GetCopy()));
children.emplace_back(name, node.GetCopy());
}
void Object::Add(const std::string &name, const Value &node)
{
children.push_back(NamedNodePtr(name, new Value(node)));
children.emplace_back(name, new Value(node));
}
void Object::Remove(const std::string &name)
{
Expand Down
2 changes: 1 addition & 1 deletion src/exif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ namespace Exiv2 {
ExifKey exifKey(key);
auto pos = findKey(exifKey);
if (pos == end()) {
exifMetadata_.push_back(Exifdatum(exifKey));
exifMetadata_.emplace_back(exifKey);
return exifMetadata_.back();
}
return *pos;
Expand Down
2 changes: 1 addition & 1 deletion src/iptc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ namespace Exiv2 {
IptcKey iptcKey(key);
auto pos = findKey(iptcKey);
if (pos == end()) {
iptcMetadata_.push_back(Iptcdatum(iptcKey));
iptcMetadata_.emplace_back(iptcKey);
return iptcMetadata_.back();
}
return *pos;
Expand Down

0 comments on commit e7eddfc

Please sign in to comment.