style: clang-tidy: modernize-use-emplace
diff --git a/.clang-tidy b/.clang-tidy
index d04beea..a4eab6a 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -8,6 +8,7 @@
modernize-use-using,
modernize-use-equals-default,
modernize-use-auto,
+modernize-use-emplace,
'
HeaderFilterRegex: 'pybind11/.*h'
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index ec7fc4a..3185d4b 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -543,7 +543,7 @@
self_value_and_holder.type->dealloc(self_value_and_holder);
call.init_self = PyTuple_GET_ITEM(args_in, 0);
- call.args.push_back(reinterpret_cast<PyObject *>(&self_value_and_holder));
+ call.args.emplace_back(reinterpret_cast<PyObject *>(&self_value_and_holder));
call.args_convert.push_back(false);
++args_copied;
}
diff --git a/tests/pybind11_tests.cpp b/tests/pybind11_tests.cpp
index 76e0298..24b65df 100644
--- a/tests/pybind11_tests.cpp
+++ b/tests/pybind11_tests.cpp
@@ -32,11 +32,11 @@
}
test_initializer::test_initializer(Initializer init) {
- initializers().push_back(init);
+ initializers().emplace_back(init);
}
test_initializer::test_initializer(const char *submodule_name, Initializer init) {
- initializers().push_back([=](py::module &parent) {
+ initializers().emplace_back([=](py::module &parent) {
auto m = parent.def_submodule(submodule_name);
init(m);
});