From 119db695caed1791aaf5be9e2a70df54b5dbc173 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 27 Jul 2021 16:18:30 -0700 Subject: [PATCH] Follow-on to PR #3148 (cang-tidy). --- tests/test_class_sh_basic.cpp | 2 +- tests/test_class_sh_factory_constructors.cpp | 4 ++-- tests/test_class_sh_inheritance.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_class_sh_basic.cpp b/tests/test_class_sh_basic.cpp index 4457aa819..332f10a28 100644 --- a/tests/test_class_sh_basic.cpp +++ b/tests/test_class_sh_basic.cpp @@ -43,7 +43,7 @@ std::string pass_mref(atyp& obj) { return "pass_mref:" + obj.mtxt; } std::string pass_cptr(atyp const* obj) { return "pass_cptr:" + obj->mtxt; } std::string pass_mptr(atyp* obj) { return "pass_mptr:" + obj->mtxt; } -std::shared_ptr rtrn_shmp() { return std::shared_ptr(new atyp{"rtrn_shmp"}); } +std::shared_ptr rtrn_shmp() { return std::make_shared("rtrn_shmp"); } std::shared_ptr rtrn_shcp() { return std::shared_ptr(new atyp{"rtrn_shcp"}); } std::string pass_shmp(std::shared_ptr obj) { return "pass_shmp:" + obj->mtxt; } // NOLINT diff --git a/tests/test_class_sh_factory_constructors.cpp b/tests/test_class_sh_factory_constructors.cpp index 7e8025f0e..dae8aa037 100644 --- a/tests/test_class_sh_factory_constructors.cpp +++ b/tests/test_class_sh_factory_constructors.cpp @@ -40,7 +40,7 @@ atyp_mref& rtrn_mref() { static atyp_mref obj; obj.mtxt = "Mref"; return o atyp_cptr const* rtrn_cptr() { return new atyp_cptr{"Cptr"}; } atyp_mptr* rtrn_mptr() { return new atyp_mptr{"Mptr"}; } -std::shared_ptr rtrn_shmp() { return std::shared_ptr(new atyp_shmp{"Shmp"}); } +std::shared_ptr rtrn_shmp() { return std::make_shared(atyp_shmp{"Shmp"}); } std::shared_ptr rtrn_shcp() { return std::shared_ptr(new atyp_shcp{"Shcp"}); } std::unique_ptr rtrn_uqmp() { return std::unique_ptr(new atyp_uqmp{"Uqmp"}); } @@ -164,7 +164,7 @@ TEST_SUBMODULE(class_sh_factory_constructors, m) { return p; })) .def(py::init([](int i, int j, int k) { - auto p = std::shared_ptr(new with_alias_alias); + auto p = std::make_shared(); p->val = i * 100 + j * 10 + k; return p; })) diff --git a/tests/test_class_sh_inheritance.cpp b/tests/test_class_sh_inheritance.cpp index 1584336e6..d5b05cd8c 100644 --- a/tests/test_class_sh_inheritance.cpp +++ b/tests/test_class_sh_inheritance.cpp @@ -34,8 +34,8 @@ inline base *rtrn_mptr_drvd_up_cast() { return new drvd; } inline int pass_cptr_base(base const *b) { return b->id() + 11; } inline int pass_cptr_drvd(drvd const *d) { return d->id() + 12; } -inline std::shared_ptr rtrn_shmp_drvd() { return std::shared_ptr(new drvd); } -inline std::shared_ptr rtrn_shmp_drvd_up_cast() { return std::shared_ptr(new drvd); } +inline std::shared_ptr rtrn_shmp_drvd() { return std::make_shared(); } +inline std::shared_ptr rtrn_shmp_drvd_up_cast() { return std::make_shared(); } inline int pass_shcp_base(const std::shared_ptr& b) { return b->id() + 21; } inline int pass_shcp_drvd(const std::shared_ptr& d) { return d->id() + 22; }