blob: ccaf72d7e55077e6b2f3d3494f22228bff15b941 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <sstream>
11
12// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
13// class basic_stringstream
14
15// basic_stringstream& operator=(basic_stringstream&& rhs);
16
17#include <sstream>
18#include <cassert>
19
20int main()
21{
Howard Hinnant7609c9b2010-09-04 23:28:19 +000022#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant3e519522010-05-11 19:42:16 +000023 {
24 std::stringstream ss0(" 123 456 ");
25 std::stringstream ss;
26 ss = std::move(ss0);
27 assert(ss.rdbuf() != 0);
28 assert(ss.good());
29 assert(ss.str() == " 123 456 ");
30 int i = 0;
31 ss >> i;
32 assert(i == 123);
33 ss >> i;
34 assert(i == 456);
35 ss << i << ' ' << 123;
36 assert(ss.str() == "456 1236 ");
37 }
38 {
39 std::wstringstream ss0(L" 123 456 ");
40 std::wstringstream ss;
41 ss = std::move(ss0);
42 assert(ss.rdbuf() != 0);
43 assert(ss.good());
44 assert(ss.str() == L" 123 456 ");
45 int i = 0;
46 ss >> i;
47 assert(i == 123);
48 ss >> i;
49 assert(i == 456);
50 ss << i << ' ' << 123;
51 assert(ss.str() == L"456 1236 ");
52 }
Howard Hinnant7609c9b2010-09-04 23:28:19 +000053#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant3e519522010-05-11 19:42:16 +000054}