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