1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <sstream>
11 
12 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
13 // class basic_ostringstream
14 
15 // basic_ostringstream(basic_ostringstream&& rhs);
16 
17 #include <sstream>
18 #include <cassert>
19 
main()20 int main()
21 {
22 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
23     {
24         std::ostringstream ss0(" 123 456");
25         std::ostringstream ss(std::move(ss0));
26         assert(ss.rdbuf() != 0);
27         assert(ss.good());
28         assert(ss.str() == " 123 456");
29         int i = 234;
30         ss << i << ' ' << 567;;
31         assert(ss.str() == "234 5676");
32     }
33     {
34         std::wostringstream ss0(L" 123 456");
35         std::wostringstream ss(std::move(ss0));
36         assert(ss.rdbuf() != 0);
37         assert(ss.good());
38         assert(ss.str() == L" 123 456");
39         int i = 234;
40         ss << i << ' ' << 567;;
41         assert(ss.str() == L"234 5676");
42     }
43 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
44 }
45