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// const T* operator->() const;
14
15#include <iterator>
16#include <sstream>
17#include <cassert>
18
19#include "test_macros.h"
20
21struct A
22{
23 double d_;
24 int i_;
25};
26
27void operator&(A const&) {}
28
29std::istream& operator>>(std::istream& is, A& a)
30{
31 return is >> a.d_ >> a.i_;
32}
33
34int main(int, char**)
35{
36 std::istringstream inf("1.5 23 ");
37 std::istream_iterator<A> i(inf);
38 assert(i->d_ == 1.5);
39 assert(i->i_ == 23);
40
41 return 0;
42}
43

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