diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-11-05 12:16:13 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-11-05 13:31:32 +0000 |
commit | 432258be4f2cf4f0970f106db319e3dbab4ab13d (patch) | |
tree | 1c1c9d60c27e86527efb1ebce7cea15358519af1 /gcc | |
parent | cbc3f0bcc0e6dba4be2873f7ed7b63de6f8fc524 (diff) | |
download | gcc-432258be4f2cf4f0970f106db319e3dbab4ab13d.zip gcc-432258be4f2cf4f0970f106db319e3dbab4ab13d.tar.gz gcc-432258be4f2cf4f0970f106db319e3dbab4ab13d.tar.bz2 |
libstdc++: Fix new <sstream> constructors
- Add a missing 'explicit' to a basic_stringbuf constructor.
- Set up the get/put area pointers in the constructor from strings using
different allocator types.
- Remove public basic_stringbuf::__sv_type alias.
- Do not construct temporary basic_string objects with a
default-constructed allocator.
Also, change which basic_string constructor is used, as a minor
compile-time optimization. Constructing from a basic_string_view
requires more work from the compiler, so just use a pointer and length.
libstdc++-v3/ChangeLog:
* include/std/sstream (basic_stringbuf(const allocator_type&):
Add explicit.
(basic_stringbuf(const basic_string<C,T,SA>&, openmode, const A&)):
Call _M_stringbuf_init. Construct _M_string from pointer and length
to avoid constraint checks for string view.
(basic_stringbuf::view()): Make __sv_type alias local to the
function.
(basic_istringstream(const basic_string<C,T,SA>&, openmode, const A&)):
Pass string to _M_streambuf instead of constructing a temporary
with the wrong allocator.
(basic_ostringstream(const basic_string<C,T,SA>&, openmode, const A&)):
Likewise.
(basic_stringstream(const basic_string<C,T,SA>&, openmode, const A&)):
Likewise.
* src/c++20/sstream-inst.cc: Use string_view and wstring_view
typedefs in explicit instantiations.
* testsuite/27_io/basic_istringstream/cons/char/1.cc: Add more
tests for constructors.
* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions