From ef6907c1aeec4b07e74ece23aa78cdcbd3cad234 Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Thu, 24 Jun 2021 11:50:31 +0200 Subject: [PATCH] SH, shared_ptr copy/move, make MSVC happy --- tests/test_class_sh_shared_ptr_copy_move.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/test_class_sh_shared_ptr_copy_move.cpp b/tests/test_class_sh_shared_ptr_copy_move.cpp index 3c6872cec..a0b9fde5b 100644 --- a/tests/test_class_sh_shared_ptr_copy_move.cpp +++ b/tests/test_class_sh_shared_ptr_copy_move.cpp @@ -9,20 +9,15 @@ namespace pybind11_tests { namespace { +const std::string fooNames[] = {"ShPtr_", "SmHld_"}; + template struct Foo { std::string mtxt; Foo(const std::string &mtxt_) : mtxt(mtxt_) {} Foo(const Foo &other) = delete; - Foo(Foo &&other) = delete; - std::string get_text() const { - std::string res = "Foo"; - if (SerNo == 0) - res += "ShPtr_"; - else if (SerNo == 1) - res += "SmHld_"; - return res + mtxt; - } + Foo(Foo &&other) = delete; + std::string get_text() const { return "Foo" + fooNames[SerNo] + mtxt; } }; using FooShPtr = Foo<0>;