[libc++] Remove some _LIBCPP_CXX03_LANG from iostreams headers.

With the STL containers, I didn't enable move operations in C++03 mode
because that would change the overload resolution for things that today
are copy operations. With iostreams, though, the copy operations aren't
present at all, and so I see no problem with enabling move operations
even in (Clang's greatly extended) C++03 mode.

Clang's C++03 mode does not support delegating constructors.

Differential Revision: https://reviews.llvm.org/D104310
This commit is contained in:
Arthur O'Dwyer 2021-06-15 12:47:05 -04:00
parent 88d5eba139
commit a8d1182f66
31 changed files with 31 additions and 164 deletions

View File

@ -219,16 +219,12 @@ public:
// 27.9.1.2 Constructors/destructor:
basic_filebuf();
#ifndef _LIBCPP_CXX03_LANG
basic_filebuf(basic_filebuf&& __rhs);
#endif
virtual ~basic_filebuf();
// 27.9.1.3 Assign/swap:
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_filebuf& operator=(basic_filebuf&& __rhs);
#endif
void swap(basic_filebuf& __rhs);
// 27.9.1.4 Members:
@ -318,8 +314,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
setbuf(nullptr, 4096);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
: basic_streambuf<_CharT, _Traits>(__rhs)
@ -394,8 +388,6 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
{
@ -1164,13 +1156,10 @@ public:
: basic_ifstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
#endif
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_ifstream(basic_ifstream&& __rhs);
_LIBCPP_INLINE_VISIBILITY
basic_ifstream& operator=(basic_ifstream&& __rhs);
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ifstream& __rhs);
@ -1240,8 +1229,6 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
}
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
@ -1261,8 +1248,6 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
void
@ -1379,13 +1364,10 @@ public:
: basic_ofstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_ofstream(basic_ofstream&& __rhs);
_LIBCPP_INLINE_VISIBILITY
basic_ofstream& operator=(basic_ofstream&& __rhs);
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ofstream& __rhs);
@ -1454,8 +1436,6 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
}
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
@ -1475,8 +1455,6 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
void
@ -1595,13 +1573,12 @@ public:
#endif // _LIBCPP_STD_VER >= 17
#endif
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_fstream(basic_fstream&& __rhs);
_LIBCPP_INLINE_VISIBILITY
basic_fstream& operator=(basic_fstream&& __rhs);
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_fstream& __rhs);
@ -1668,8 +1645,6 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
}
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
@ -1689,8 +1664,6 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
void

View File

@ -662,10 +662,8 @@ protected:
_LIBCPP_INLINE_VISIBILITY
void move(basic_ios& __rhs);
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY

View File

@ -192,14 +192,12 @@ public:
{ this->init(__sb); }
virtual ~basic_istream();
protected:
#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_istream(basic_istream&& __rhs);
// 27.7.1.1.2 Assign/swap:
inline _LIBCPP_INLINE_VISIBILITY
basic_istream& operator=(basic_istream&& __rhs);
#endif
inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
void swap(basic_istream& __rhs) {
@ -207,10 +205,8 @@ protected:
basic_ios<char_type, traits_type>::swap(__rhs);
}
#ifndef _LIBCPP_CXX03_LANG
basic_istream (const basic_istream& __rhs) = delete;
basic_istream& operator=(const basic_istream& __rhs) = delete;
#endif
public:
// 27.7.1.1.3 Prefix/suffix:
@ -333,8 +329,6 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.setstate(ios_base::failbit);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
: __gc_(__rhs.__gc_)
@ -351,8 +345,6 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>::~basic_istream()
{
@ -1416,21 +1408,18 @@ public:
virtual ~basic_iostream();
protected:
#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_iostream(basic_iostream&& __rhs);
// assign/swap
inline _LIBCPP_INLINE_VISIBILITY
basic_iostream& operator=(basic_iostream&& __rhs);
#endif
inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
void swap(basic_iostream& __rhs)
{ basic_istream<char_type, traits_type>::swap(__rhs); }
};
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
@ -1445,8 +1434,6 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::~basic_iostream()
{
@ -1570,8 +1557,6 @@ getline(basic_istream<_CharT, _Traits>& __is,
return getline(__is, __str, __is.widen('\n'));
}
#ifndef _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
@ -1590,8 +1575,6 @@ getline(basic_istream<_CharT, _Traits>&& __is,
return getline(__is, __str, __is.widen('\n'));
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)

View File

@ -165,27 +165,21 @@ public:
{ this->init(__sb); }
virtual ~basic_ostream();
protected:
#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream(basic_ostream&& __rhs);
// 27.7.2.3 Assign/swap
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs);
#endif
inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
void swap(basic_ostream& __rhs)
{ basic_ios<char_type, traits_type>::swap(__rhs); }
#ifndef _LIBCPP_CXX03_LANG
basic_ostream (const basic_ostream& __rhs) = delete;
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
#else
basic_ostream (const basic_ostream& __rhs); // not defined
basic_ostream& operator=(const basic_ostream& __rhs); // not defined
#endif
public:
public:
// 27.7.2.4 Prefix/suffix:
class _LIBCPP_TEMPLATE_VIS sentry;
@ -291,8 +285,6 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
}
}
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
{
@ -307,8 +299,6 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::~basic_ostream()
{

View File

@ -219,19 +219,13 @@ private:
public:
// 30.8.2.1 [stringbuf.cons], constructors
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {}
basic_stringbuf()
: __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {}
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringbuf(ios_base::openmode __wch)
: __hm_(nullptr), __mode_(__wch) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in |
ios_base::out)
: __hm_(nullptr), __mode_(__wch) {}
#endif
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringbuf(const string_type& __s,
@ -643,18 +637,13 @@ private:
public:
// 30.8.3.1 [istringstream.cons], constructors
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_istringstream() : basic_istringstream(ios_base::in) {}
basic_istringstream()
: basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {}
_LIBCPP_INLINE_VISIBILITY
explicit basic_istringstream(ios_base::openmode __wch)
: basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in)
: basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {}
#endif
_LIBCPP_INLINE_VISIBILITY
explicit basic_istringstream(const string_type& __s,
@ -728,20 +717,13 @@ private:
public:
// 30.8.4.1 [ostringstream.cons], constructors
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_ostringstream() : basic_ostringstream(ios_base::out) {}
basic_ostringstream()
: basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {}
_LIBCPP_INLINE_VISIBILITY
explicit basic_ostringstream(ios_base::openmode __wch)
: basic_ostream<_CharT, _Traits>(&__sb_),
__sb_(__wch | ios_base::out) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out)
: basic_ostream<_CharT, _Traits>(&__sb_),
__sb_(__wch | ios_base::out) {}
#endif
: basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) {}
_LIBCPP_INLINE_VISIBILITY
explicit basic_ostringstream(const string_type& __s,
@ -816,19 +798,13 @@ private:
public:
// 30.8.5.1 [stringstream.cons], constructors
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_stringstream() : basic_stringstream(ios_base::in | ios_base::out) {}
basic_stringstream()
: basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {}
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringstream(ios_base::openmode __wch)
: basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in |
ios_base::out)
: basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {}
#endif
_LIBCPP_INLINE_VISIBILITY
explicit basic_stringstream(const string_type& __s,

View File

@ -4439,8 +4439,6 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
#ifndef _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
@ -4453,8 +4451,6 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 17
template <class _CharT, class _Traits, class _Allocator, class _Up>
inline _LIBCPP_INLINE_VISIBILITY

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <fstream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <fstream>
// template <class charT, class traits = char_traits<charT> >
@ -31,7 +29,7 @@ int main(int, char**)
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
assert(f.sgetc() == '2');
std::filebuf f2(move(f));
std::filebuf f2(std::move(f));
assert(!f.is_open());
assert(f2.is_open());
assert(f2.sgetc() == '2');
@ -45,7 +43,7 @@ int main(int, char**)
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
assert(f.sgetc() == L'2');
std::wfilebuf f2(move(f));
std::wfilebuf f2(std::move(f));
assert(!f.is_open());
assert(f2.is_open());
assert(f2.sgetc() == L'2');

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <fstream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <fstream>
// template <class charT, class traits = char_traits<charT> >
@ -26,7 +24,7 @@ int main(int, char**)
{
std::fstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs = move(fso);
std::fstream fs = std::move(fso);
double x = 0;
fs << 3.25;
fs.seekg(0);
@ -37,7 +35,7 @@ int main(int, char**)
{
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs = move(fso);
std::wfstream fs = std::move(fso);
double x = 0;
fs << 3.25;
fs.seekg(0);

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// FILE_DEPENDENCIES: test.dat
// <fstream>

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// FILE_DEPENDENCIES: test.dat
// <fstream>
@ -25,14 +24,14 @@ int main(int, char**)
{
{
std::ifstream fso("test.dat");
std::ifstream fs = move(fso);
std::ifstream fs = std::move(fso);
double x = 0;
fs >> x;
assert(x == 3.25);
}
{
std::wifstream fso("test.dat");
std::wifstream fs = move(fso);
std::wifstream fs = std::move(fso);
double x = 0;
fs >> x;
assert(x == 3.25);

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <fstream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <fstream>
// template <class charT, class traits = char_traits<charT> >
@ -25,7 +23,7 @@ int main(int, char**)
std::string temp = get_temp_file_name();
{
std::ofstream fso(temp.c_str());
std::ofstream fs = move(fso);
std::ofstream fs = std::move(fso);
fs << 3.25;
}
{
@ -37,7 +35,7 @@ int main(int, char**)
std::remove(temp.c_str());
{
std::wofstream fso(temp.c_str());
std::wofstream fs = move(fso);
std::wofstream fs = std::move(fso);
fs << 3.25;
}
{

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >
@ -47,10 +45,7 @@ struct test_istream
};
int main(int, char**)
{
return 0;
}

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <ostream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <ostream>
// template <class charT, class traits = char_traits<charT> >

View File

@ -5,8 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++03
// <ios>

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >

View File

@ -22,32 +22,32 @@ int main(int, char**)
{
{
std::stringbuf buf1("testing");
std::stringbuf buf(move(buf1));
std::stringbuf buf(std::move(buf1));
assert(buf.str() == "testing");
}
{
std::stringbuf buf1("testing", std::ios_base::in);
std::stringbuf buf(move(buf1));
std::stringbuf buf(std::move(buf1));
assert(buf.str() == "testing");
}
{
std::stringbuf buf1("testing", std::ios_base::out);
std::stringbuf buf(move(buf1));
std::stringbuf buf(std::move(buf1));
assert(buf.str() == "testing");
}
{
std::wstringbuf buf1(L"testing");
std::wstringbuf buf(move(buf1));
std::wstringbuf buf(std::move(buf1));
assert(buf.str() == L"testing");
}
{
std::wstringbuf buf1(L"testing", std::ios_base::in);
std::wstringbuf buf(move(buf1));
std::wstringbuf buf(std::move(buf1));
assert(buf.str() == L"testing");
}
{
std::wstringbuf buf1(L"testing", std::ios_base::out);
std::wstringbuf buf(move(buf1));
std::wstringbuf buf(std::move(buf1));
assert(buf.str() == L"testing");
}

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <string>
// template<class charT, class traits, class Allocator>
@ -35,13 +33,13 @@ int main(int, char**)
assert(s == L" abc");
}
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S s("initial text");
getline(std::istringstream(" abc* def* ghij"), s, '*');
assert(s == " abc");
}
{
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S;
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t> > S;
S s(L"initial text");
getline(std::wistringstream(L" abc* def* ghij"), s, L'*');
assert(s == L" abc");

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <string>
// template<class charT, class traits, class Allocator>
@ -35,13 +33,13 @@ int main(int, char**)
assert(s == L" abc");
}
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S s("initial text");
getline(std::istringstream(" abc\n def\n ghij"), s);
assert(s == " abc");
}
{
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S;
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t> > S;
S s(L"initial text");
getline(std::wistringstream(L" abc\n def\n ghij"), s);
assert(s == L" abc");