mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
std: Fix std::string push_back()
Allocate 2 bytes if cap == 0, not 1.
This commit is contained in:
parent
ccb2cdde55
commit
b31d49be15
@ -1530,7 +1530,7 @@ namespace std
|
|||||||
constexpr void push_back(CharT ch)
|
constexpr void push_back(CharT ch)
|
||||||
{
|
{
|
||||||
if (_size == _capacity)
|
if (_size == _capacity)
|
||||||
reserve(_capacity == 0 ? 1 : _capacity * 2);
|
reserve(_capacity == 0 ? 2 : _capacity * 2);
|
||||||
|
|
||||||
_data[_size++] = ch;
|
_data[_size++] = ch;
|
||||||
_data[_size] = 0;
|
_data[_size] = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user