blob: 5c4ddcad32eaf482ae1de39c4b0caced72ca9e19 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <iterator>
11
12// class istream_iterator
13
14// const T* operator->() const;
15
16#include <iterator>
17#include <sstream>
18#include <cassert>
19
20struct A
21{
22 double d_;
23 int i_;
24};
25
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000026std::istream& operator>>(std::istream& is, A& a)
27{
28 return is >> a.d_ >> a.i_;
29}
30
31int main()
32{
33 std::istringstream inf("1.5 23 ");
34 std::istream_iterator<A> i(inf);
35 assert(i->d_ == 1.5);
36 assert(i->i_ == 23);
37}