diff --git a/core/test/base/utils.cpp b/core/test/base/utils.cpp index 1ad4705b824..5c6947b7cc6 100644 --- a/core/test/base/utils.cpp +++ b/core/test/base/utils.cpp @@ -83,19 +83,19 @@ TEST(PointerParam, WorksForUniquePointers) } -struct ClonableDerived : Base { - ClonableDerived(std::shared_ptr exec = nullptr) +struct CloneableDerived : Base { + CloneableDerived(std::shared_ptr exec = nullptr) : executor(exec) {} std::unique_ptr clone() { - return std::unique_ptr(new ClonableDerived()); + return std::unique_ptr(new CloneableDerived()); } std::unique_ptr clone(std::shared_ptr exec) { - return std::unique_ptr(new ClonableDerived{exec}); + return std::unique_ptr(new CloneableDerived{exec}); } std::shared_ptr executor; @@ -104,36 +104,36 @@ struct ClonableDerived : Base { TEST(Clone, ClonesUniquePointer) { - std::unique_ptr p(new ClonableDerived()); + std::unique_ptr p(new CloneableDerived()); auto clone = gko::clone(p); ::testing::StaticAssertTypeEq>(); + std::unique_ptr>(); ASSERT_NE(p.get(), clone.get()); } TEST(Clone, ClonesSharedPointer) { - std::shared_ptr p(new ClonableDerived()); + std::shared_ptr p(new CloneableDerived()); auto clone = gko::clone(p); ::testing::StaticAssertTypeEq>(); + std::unique_ptr>(); ASSERT_NE(p.get(), clone.get()); } TEST(Clone, ClonesPlainPointer) { - std::unique_ptr p(new ClonableDerived()); + std::unique_ptr p(new CloneableDerived()); auto clone = gko::clone(p.get()); ::testing::StaticAssertTypeEq>(); + std::unique_ptr>(); ASSERT_NE(p.get(), clone.get()); } @@ -141,12 +141,12 @@ TEST(Clone, ClonesPlainPointer) TEST(CloneTo, ClonesUniquePointer) { auto exec = gko::ReferenceExecutor::create(); - std::unique_ptr p(new ClonableDerived()); + std::unique_ptr p(new CloneableDerived()); auto clone = gko::clone(exec, p); ::testing::StaticAssertTypeEq>(); + std::unique_ptr>(); ASSERT_NE(p.get(), clone.get()); ASSERT_EQ(clone->executor, exec); } @@ -155,12 +155,12 @@ TEST(CloneTo, ClonesUniquePointer) TEST(CloneTo, ClonesSharedPointer) { auto exec = gko::ReferenceExecutor::create(); - std::shared_ptr p(new ClonableDerived()); + std::shared_ptr p(new CloneableDerived()); auto clone = gko::clone(exec, p); ::testing::StaticAssertTypeEq>(); + std::unique_ptr>(); ASSERT_NE(p.get(), clone.get()); ASSERT_EQ(clone->executor, exec); } @@ -169,12 +169,12 @@ TEST(CloneTo, ClonesSharedPointer) TEST(CloneTo, ClonesPlainPointer) { auto exec = gko::ReferenceExecutor::create(); - std::unique_ptr p(new ClonableDerived()); + std::unique_ptr p(new CloneableDerived()); auto clone = gko::clone(exec, p.get()); ::testing::StaticAssertTypeEq>(); + std::unique_ptr>(); ASSERT_NE(p.get(), clone.get()); ASSERT_EQ(clone->executor, exec); } diff --git a/include/ginkgo/core/base/utils_helper.hpp b/include/ginkgo/core/base/utils_helper.hpp index 3ea5c9d878d..951ea4bbf5d 100644 --- a/include/ginkgo/core/base/utils_helper.hpp +++ b/include/ginkgo/core/base/utils_helper.hpp @@ -95,32 +95,32 @@ using pointee = template -struct is_clonable_impl : std::false_type {}; +struct is_cloneable_impl : std::false_type {}; template -struct is_clonable_impl().clone())>> +struct is_cloneable_impl().clone())>> : std::true_type {}; template -constexpr bool is_clonable() +constexpr bool is_cloneable() { - return is_clonable_impl>::value; + return is_cloneable_impl>::value; } template -struct is_clonable_to_impl : std::false_type {}; +struct is_cloneable_to_impl : std::false_type {}; template -struct is_clonable_to_impl< +struct is_cloneable_to_impl< T, std::void_t().clone( std::declval>()))>> : std::true_type {}; template -constexpr bool is_clonable_to() +constexpr bool is_cloneable_to() { - return is_clonable_to_impl>::value; + return is_cloneable_to_impl>::value; } @@ -172,8 +172,8 @@ using shared_type = std::shared_ptr>; template inline detail::cloned_type clone(const Pointer& p) { - static_assert(detail::is_clonable>(), - "Object is not clonable"); + static_assert(detail::is_cloneable>(), + "Object is not cloneable"); return detail::cloned_type( static_cast>::type*>( p->clone().release())); @@ -199,8 +199,8 @@ template inline detail::cloned_type clone(std::shared_ptr exec, const Pointer& p) { - static_assert(detail::is_clonable_to>(), - "Object is not clonable"); + static_assert(detail::is_cloneable_to>(), + "Object is not cloneable"); return detail::cloned_type( static_cast>::type*>( p->clone(std::move(exec)).release()));