Debian Codegraph @

libcxx/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/proxy.pass.cpp

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