[PATCH] D32395: [clang-tidy] modernize-use-emplace: remove unnecessary make_pair calls

Jakub Kuderski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 23 03:01:04 PDT 2017


kuhar created this revision.
kuhar added a project: clang-tools-extra.

When there is a push_back with a call to make_pair, turn it into emplace_back and remove the unnecessary make_pair call.

Eg.

  std::vector<std::pair<int, int>> v;
  v.push_back(std::make_pair(1, 2)); // --> v.emplace_back(1, 2);

make_pair doesn't get removed when explicit template parameters are provided, because of potential problems with type conversions.


https://reviews.llvm.org/D32395

Files:
  clang-tidy/modernize/UseEmplaceCheck.cpp
  test/clang-tidy/modernize-use-emplace.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32395.96298.patch
Type: text/x-patch
Size: 5943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170423/c7d234bf/attachment.bin>


More information about the cfe-commits mailing list