]> sigrok.org Git - pulseview.git/commitdiff
Use emplace_back() where possible.
authorUwe Hermann <redacted>
Fri, 10 Mar 2017 20:32:43 +0000 (21:32 +0100)
committerUwe Hermann <redacted>
Sat, 11 Mar 2017 12:06:03 +0000 (13:06 +0100)
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.


No differences found