Skip to content

Commit 42beb67

Browse files
authored
Fix: fix a typo in ComplexArray (#1872)
* Fix: fix a typo urgently * invoke right value constructor in complexarray
1 parent 1dda41c commit 42beb67

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

source/module_base/complexarray.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ ComplexArray::ComplexArray(ComplexArray &&cd){
6969
}
7070
ComplexArray& ComplexArray::operator=(ComplexArray &&cd){
7171
delete [] this->ptr;
72-
std::cout<<"here"<<std::endl;
7372
this->ptr =cd.ptr; cd.ptr =nullptr;
7473
this->bound1=cd.bound1; cd.bound1=0;
7574
this->bound2=cd.bound2; cd.bound2=0;
@@ -78,7 +77,6 @@ ComplexArray& ComplexArray::operator=(ComplexArray &&cd){
7877
return *this;}
7978
ComplexArray &ComplexArray::operator=(const ComplexArray & cd){
8079
const int size = this->getSize();
81-
std::cout<<"here2"<<std::endl;
8280
assert(size==cd.getSize());
8381
for (int i = 0; i < size; i++)
8482
ptr[i] = cd.ptr[i];

source/module_base/test/complexarray_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ TEST(ComplexArray, constructor_copy_test)
143143

144144
TEST(ComplexArray, constructor_rvalue_test)
145145
{
146-
ModuleBase::ComplexArray b(ModuleBase::ComplexArray(1,2,3,4));
146+
ModuleBase::ComplexArray b(std::move(ModuleBase::ComplexArray(1,2,3,4)));
147147
ASSERT_EQ(b.getSize(),24);
148148
ASSERT_EQ(b.getBound1(),1);
149149
ASSERT_EQ(b.getBound2(),2);

0 commit comments

Comments
 (0)