1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class charT, class traits = char_traits<charT> >
13 // class basic_istream;
15 // operator>>(unsigned long& val);
20 template <class CharT>
22 : public std::basic_streambuf<CharT>
24 typedef std::basic_string<CharT> string_type;
25 typedef std::basic_streambuf<CharT> base;
31 testbuf(const string_type& str)
34 base::setg(const_cast<CharT*>(str_.data()),
35 const_cast<CharT*>(str_.data()),
36 const_cast<CharT*>(str_.data()) + str_.size());
39 CharT* eback() const {return base::eback();}
40 CharT* gptr() const {return base::gptr();}
41 CharT* egptr() const {return base::egptr();}
47 std::istream is((std::streambuf*)0);
53 testbuf<char> sb("0");
62 testbuf<char> sb(" 123 ");
71 testbuf<wchar_t> sb(L" 123 ");
72 std::wistream is(&sb);