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 // class istream_iterator
12 
13 // istream_iterator(const istream_iterator& x);
14 //  C++17 says:  If is_trivially_copy_constructible_v<T> is true, then
15 //     this constructor is a trivial copy constructor.
16 
17 #include <iterator>
18 #include <sstream>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 
main(int,char **)23 int main(int, char**)
24 {
25     {
26         std::istream_iterator<int> io;
27         std::istream_iterator<int> i = io;
28         assert(i == std::istream_iterator<int>());
29     }
30     {
31         std::istringstream inf(" 1 23");
32         std::istream_iterator<int> io(inf);
33         std::istream_iterator<int> i = io;
34         assert(i != std::istream_iterator<int>());
35         int j = 0;
36         j = *i;
37         assert(j == 1);
38     }
39 
40   return 0;
41 }
42