fixed a bug, where Char::operator= made the allocated data larger than
needed
This commit is contained in:
parent
af27d29d29
commit
c1254caf25
2
Char.cpp
2
Char.cpp
@ -8,7 +8,7 @@ Char::operator char() const
|
||||
|
||||
Char& Char::operator=(char other)
|
||||
{
|
||||
auto data = new char[_string.size() + 2]; // space for new char & null-terminator
|
||||
auto data = new char[_string.size() + 1]; // space for old string & null-terminator
|
||||
std::strcpy(data, _string.c_str());
|
||||
data[_index] = other; // set the desired char
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user