• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_stringbuf
14 
15 // explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& s,
16 //                          ios_base::openmode which = ios_base::in | ios_base::out);
17 
18 #include <sstream>
19 #include <cassert>
20 
main()21 int main()
22 {
23     {
24         std::stringbuf buf("testing");
25         assert(buf.str() == "testing");
26     }
27     {
28         std::stringbuf buf("testing", std::ios_base::in);
29         assert(buf.str() == "testing");
30     }
31     {
32         std::stringbuf buf("testing", std::ios_base::out);
33         assert(buf.str() == "testing");
34     }
35     {
36         std::wstringbuf buf(L"testing");
37         assert(buf.str() == L"testing");
38     }
39     {
40         std::wstringbuf buf(L"testing", std::ios_base::in);
41         assert(buf.str() == L"testing");
42     }
43     {
44         std::wstringbuf buf(L"testing", std::ios_base::out);
45         assert(buf.str() == L"testing");
46     }
47 }
48