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>& operator++(); 15 // ostreambuf_iterator<charT,traits>& operator++(int); 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 std::ostreambuf_iterator<char>& iref = ++i; 27 assert(&iref == &i); 28 std::ostreambuf_iterator<char>& iref2 = i++; 29 assert(&iref2 == &i); 30 } 31 { 32 std::wostringstream outf; 33 std::ostreambuf_iterator<wchar_t> i(outf); 34 std::ostreambuf_iterator<wchar_t>& iref = ++i; 35 assert(&iref == &i); 36 std::ostreambuf_iterator<wchar_t>& iref2 = i++; 37 assert(&iref2 == &i); 38 } 39 } 40