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