diff --git a/btas/tensor.h b/btas/tensor.h index 7d22aec9..106098da 100644 --- a/btas/tensor.h +++ b/btas/tensor.h @@ -201,7 +201,11 @@ namespace btas { /// copy constructor /// It will accept Tensors and TensorViews template ::value>::type> - Tensor(const _Tensor& x) : range_(x.range().lobound(), x.range().upbound()), storage_(x.cbegin(), x.cend()) {} + Tensor(const _Tensor& x) : range_(x.range().lobound(), x.range().upbound()){ + auto size = range_.area(); + array_adaptor::resize(storage_, size); + std::copy(x.cbegin(), x.cend(), storage_.begin()); + } /// copy constructor /// @note this makes a shallow copy of @п х if `storage_type` has shallow-copy semantics; if need a deep copy