Skip to content

Commit 18f15fe

Browse files
committed
Merge pull request Mooophy#464 from clarelsy/patch-5
Improving 14_23.cpp
2 parents 494cd00 + 3c680a8 commit 18f15fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ch14/ex14_23.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ bool operator>=(const StrVec &lhs, const StrVec &rhs)
146146

147147
StrVec& StrVec::operator=(std::initializer_list<std::string> il)
148148
{
149-
*this = StrVec(il);
149+
auto data = alloc_n_copy(il.begin(), il.end());
150+
free();
151+
elements = data.first;
152+
first_free = cap = data.second;
150153
return *this;
151154
}

0 commit comments

Comments
 (0)