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