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