Commit cbc67955 by Neil Ferguson Committed by Paolo Carlini

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
parent fe16ab7e
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>
PR libstdc++/6243
......
......@@ -474,7 +474,7 @@ namespace std
void
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())
__throw_length_error("basic_string::reserve");
......
......@@ -140,7 +140,7 @@ void test01()
VERIFY( sz04 >= 100 );
str02.reserve();
sz03 = str02.capacity();
VERIFY( sz03 > 0 );
VERIFY( sz03 >= 0 );
sz03 = str02.size() + 5;
str02.resize(sz03);
......
......@@ -37,7 +37,7 @@ void test01()
VERIFY( sz02 >= 100 );
str01.reserve();
sz01 = str01.capacity();
VERIFY( sz01 > 0 );
VERIFY( sz01 >= 0 );
sz01 = str01.size() + 5;
str01.resize(sz01);
......
......@@ -37,7 +37,7 @@ void test01()
VERIFY( sz02 >= 100 );
str01.reserve();
sz01 = str01.capacity();
VERIFY( sz01 > 0 );
VERIFY( sz01 >= 0 );
sz01 = str01.size() + 5;
str01.resize(sz01);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment