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 operator++(int);
14
15#include <iterator>
16#include <sstream>
17#include <cassert>
18
19#include "test_macros.h"
20
21int main(int, char**)
22{
23 std::istringstream inf(" 1 23");
24 std::istream_iterator<int> i(inf);
25 std::istream_iterator<int> icopy = i++;
26 assert(icopy == i);
27 int j = 0;
28 j = *i;
29 assert(j == 23);
30 j = 0;
31 j = *icopy;
32 assert(j == 1);
33
34 return 0;
35}
36

source code of libcxx/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/post_increment.pass.cpp