From dd849a87368f74a45cb763d3c10da50aea9c5487 Mon Sep 17 00:00:00 2001 From: "Po-Yen, Chen" Date: Fri, 19 Aug 2022 01:02:36 -0400 Subject: [PATCH] Re-use CopyAsType<>() to implement copy ctor --- library/include/ck/library/utility/host_tensor.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/include/ck/library/utility/host_tensor.hpp b/library/include/ck/library/utility/host_tensor.hpp index 75351789e2..4cb200ccc0 100644 --- a/library/include/ck/library/utility/host_tensor.hpp +++ b/library/include/ck/library/utility/host_tensor.hpp @@ -254,7 +254,7 @@ struct Tensor Tensor(const HostTensorDescriptor& desc) : mDesc(desc), mData(mDesc.GetElementSpaceSize()) {} template - Tensor CopyAsType() + Tensor CopyAsType() const { Tensor ret(mDesc); for(size_t i = 0; i < mData.size(); i++) @@ -266,11 +266,10 @@ struct Tensor Tensor(const Tensor& other) : mDesc(other.mDesc), mData(other.mData) {} - template >> - Tensor(const Tensor& other) - : mDesc(other.mDesc), mData(std::begin(other.mData), std::end(other.mData)) + Tensor(Tensor&& other) = default; + + template + Tensor(const Tensor& other) : Tensor(other.template CopyAsType()) { }