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

source code of libcxx/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/istream.pass.cpp