1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 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 20 struct A 21 { 22 double d_; 23 int i_; 24 }; 25 26 void operator&(A const&) {} 27 28 std::istream& operator>>(std::istream& is, A& a) 29 { 30 return is >> a.d_ >> a.i_; 31 } 32 33 int main() 34 { 35 std::istringstream inf("1.5 23 "); 36 std::istream_iterator<A> i(inf); 37 assert(i->d_ == 1.5); 38 assert(i->i_ == 23); 39 } 40