Home | History | Annotate | Download | only in istream_extractors
      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 // <istream>
     11 
     12 // template <class charT, class traits = char_traits<charT> >
     13 //   class basic_istream;
     14 
     15 // basic_istream<charT,traits>& operator>>(basic_ios<charT,traits>&
     16 //                                         (*pf)(basic_ios<charT,traits>&));
     17 
     18 #include <istream>
     19 #include <cassert>
     20 
     21 int f_called = 0;
     22 
     23 template <class CharT>
     24 std::basic_ios<CharT>&
     25 f(std::basic_ios<CharT>& is)
     26 {
     27     ++f_called;
     28     return is;
     29 }
     30 
     31 int main()
     32 {
     33     {
     34         std::istream is((std::streambuf*)0);
     35         is >> f;
     36         assert(f_called == 1);
     37     }
     38 }
     39