basic_string.tcc (reserve): Allow shrink-to-fit.
2003-12-11 Neil Ferguson <nferguso@eso.org> Paolo Carlini <pcarlini@suse.de> * include/bits/basic_string.tcc (reserve): Allow shrink-to-fit. * testsuite/21_strings/basic_string/capacity/1.cc: Tweak. * testsuite/21_strings/basic_string/capacity/char/1.cc: Ditto. * testsuite/21_strings/basic_string/capacity/wchar_t/1.cc: Ditto. Co-Authored-By: Paolo Carlini <pcarlini@suse.de> From-SVN: r74551
This commit is contained in:
parent
fe16ab7e3e
commit
cbc6795585
|
@ -1,3 +1,11 @@
|
||||||
|
2003-12-11 Neil Ferguson <nferguso@eso.org>
|
||||||
|
Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* include/bits/basic_string.tcc (reserve): Allow shrink-to-fit.
|
||||||
|
* testsuite/21_strings/basic_string/capacity/1.cc: Tweak.
|
||||||
|
* testsuite/21_strings/basic_string/capacity/char/1.cc: Ditto.
|
||||||
|
* testsuite/21_strings/basic_string/capacity/wchar_t/1.cc: Ditto.
|
||||||
|
|
||||||
2003-12-10 Benjamin Kosnik <bkoz@redhat.com>
|
2003-12-10 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
PR libstdc++/6243
|
PR libstdc++/6243
|
||||||
|
|
|
@ -474,7 +474,7 @@ namespace std
|
||||||
void
|
void
|
||||||
basic_string<_CharT, _Traits, _Alloc>::reserve(size_type __res)
|
basic_string<_CharT, _Traits, _Alloc>::reserve(size_type __res)
|
||||||
{
|
{
|
||||||
if (__res > this->capacity() || _M_rep()->_M_is_shared())
|
if (__res != this->capacity() || _M_rep()->_M_is_shared())
|
||||||
{
|
{
|
||||||
if (__res > this->max_size())
|
if (__res > this->max_size())
|
||||||
__throw_length_error("basic_string::reserve");
|
__throw_length_error("basic_string::reserve");
|
||||||
|
|
|
@ -140,7 +140,7 @@ void test01()
|
||||||
VERIFY( sz04 >= 100 );
|
VERIFY( sz04 >= 100 );
|
||||||
str02.reserve();
|
str02.reserve();
|
||||||
sz03 = str02.capacity();
|
sz03 = str02.capacity();
|
||||||
VERIFY( sz03 > 0 );
|
VERIFY( sz03 >= 0 );
|
||||||
|
|
||||||
sz03 = str02.size() + 5;
|
sz03 = str02.size() + 5;
|
||||||
str02.resize(sz03);
|
str02.resize(sz03);
|
||||||
|
|
|
@ -37,7 +37,7 @@ void test01()
|
||||||
VERIFY( sz02 >= 100 );
|
VERIFY( sz02 >= 100 );
|
||||||
str01.reserve();
|
str01.reserve();
|
||||||
sz01 = str01.capacity();
|
sz01 = str01.capacity();
|
||||||
VERIFY( sz01 > 0 );
|
VERIFY( sz01 >= 0 );
|
||||||
|
|
||||||
sz01 = str01.size() + 5;
|
sz01 = str01.size() + 5;
|
||||||
str01.resize(sz01);
|
str01.resize(sz01);
|
||||||
|
|
|
@ -37,7 +37,7 @@ void test01()
|
||||||
VERIFY( sz02 >= 100 );
|
VERIFY( sz02 >= 100 );
|
||||||
str01.reserve();
|
str01.reserve();
|
||||||
sz01 = str01.capacity();
|
sz01 = str01.capacity();
|
||||||
VERIFY( sz01 > 0 );
|
VERIFY( sz01 >= 0 );
|
||||||
|
|
||||||
sz01 = str01.size() + 5;
|
sz01 = str01.size() + 5;
|
||||||
str01.resize(sz01);
|
str01.resize(sz01);
|
||||||
|
|
Loading…
Reference in New Issue