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 // explicit basic_ostringstream(ios_base::openmode which = ios_base::in); 16 17 #include <sstream> 18 #include <cassert> 19 20 int main() 21 { 22 { 23 std::ostringstream ss; 24 assert(ss.rdbuf() != 0); 25 assert(ss.good()); 26 assert(ss.str() == ""); 27 } 28 { 29 std::ostringstream ss(std::ios_base::out); 30 assert(ss.rdbuf() != 0); 31 assert(ss.good()); 32 assert(ss.str() == ""); 33 } 34 { 35 std::wostringstream ss; 36 assert(ss.rdbuf() != 0); 37 assert(ss.good()); 38 assert(ss.str() == L""); 39 } 40 { 41 std::wostringstream ss(std::ios_base::out); 42 assert(ss.rdbuf() != 0); 43 assert(ss.good()); 44 assert(ss.str() == L""); 45 } 46 } 47