Mod: add "_len" initiation
在拷贝构造函数中,添加长度的初始化列表
This commit is contained in:
committed by
GitHub
parent
388564c9d9
commit
e76957a7e3
@@ -42,7 +42,7 @@ public:
|
||||
}
|
||||
|
||||
// copy ctor
|
||||
MyStringNoMove(const MyStringNoMove &str) {
|
||||
MyStringNoMove(const MyStringNoMove &str) : _len(str._len) {
|
||||
++CCtor;
|
||||
_init_data(str._data);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
}
|
||||
|
||||
// copy ctor
|
||||
MyString(const MyString &str) {
|
||||
MyString(const MyString &str) : _len(str._len) {
|
||||
++CCtor;
|
||||
_init_data(str._data);
|
||||
}
|
||||
@@ -279,4 +279,4 @@ int main() {
|
||||
// test_moveable(multiset<MyString>(), multiset<MyStringNoMove>(), value);
|
||||
// test_moveable(unordered_multiset<MyString>(), unordered_multiset<MyStringNoMove>(), value);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user