1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <sstream> 10 11 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 12 // class basic_stringstream 13 14 // explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in); 15 16 #include <sstream> 17 #include <cassert> 18 19 int main(int, char**) 20 { 21 { 22 std::stringstream ss; 23 assert(ss.rdbuf() != 0); 24 assert(ss.good()); 25 assert(ss.str() == ""); 26 } 27 { 28 std::stringstream ss(std::ios_base::in); 29 assert(ss.rdbuf() != 0); 30 assert(ss.good()); 31 assert(ss.str() == ""); 32 } 33 { 34 std::wstringstream ss; 35 assert(ss.rdbuf() != 0); 36 assert(ss.good()); 37 assert(ss.str() == L""); 38 } 39 { 40 std::wstringstream ss(std::ios_base::in); 41 assert(ss.rdbuf() != 0); 42 assert(ss.good()); 43 assert(ss.str() == L""); 44 } 45 46 return 0; 47 } 48