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 // <iterator> 11 12 // class ostreambuf_iterator 13 14 // ostreambuf_iterator<charT,traits>& 15 // operator=(charT c); 16 17 #include <iterator> 18 #include <sstream> 19 #include <cassert> 20 21 int main() 22 { 23 { 24 std::ostringstream outf; 25 std::ostreambuf_iterator<char> i(outf); 26 i = 'a'; 27 assert(outf.str() == "a"); 28 i = 'b'; 29 assert(outf.str() == "ab"); 30 } 31 { 32 std::wostringstream outf; 33 std::ostreambuf_iterator<wchar_t> i(outf); 34 i = L'a'; 35 assert(outf.str() == L"a"); 36 i = L'b'; 37 assert(outf.str() == L"ab"); 38 } 39 } 40