Use emplace_back() where possible.
This patch was generated using clang-tidy:
clang-tidy -checks="-*,modernize-use-emplace" -fix
Using emplace_back() has multiple advantages:
- It's usually shorter and easier to read.
- It's more efficient.
V1: v.push_back("foo");
V2: v.emplace_back("foo");
V1 will construct a temporary std::string from the string literal "foo",
another copy of that temporary object will be constructed and placed
into the vector 'v', then the temporary object's destructor will be called.
V2 will simply create a std::string directly in the vector 'v', i.e.
there's only one construction (not 2) and no destructor needs to be called.