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 // istreambuf_iterator
13 
14 // istreambuf_iterator<charT,traits>&
15 //   istreambuf_iterator<charT,traits>::operator++();
16 
17 #include <iterator>
18 #include <sstream>
19 #include <cassert>
20 
main()21 int main()
22 {
23     {
24         std::istringstream inf("abc");
25         std::istreambuf_iterator<char> i(inf);
26         assert(*i == 'a');
27         assert(*++i == 'b');
28         assert(*++i == 'c');
29         assert(++i == std::istreambuf_iterator<char>());
30     }
31     {
32         std::wistringstream inf(L"abc");
33         std::istreambuf_iterator<wchar_t> i(inf);
34         assert(*i == L'a');
35         assert(*++i == L'b');
36         assert(*++i == L'c');
37         assert(++i == std::istreambuf_iterator<wchar_t>());
38     }
39 }
40