| //===----------------------------------------------------------------------===// |
| // |
| // The LLVM Compiler Infrastructure |
| // |
| // This file is dual licensed under the MIT and the University of Illinois Open |
| // Source Licenses. See LICENSE.TXT for details. |
| // |
| //===----------------------------------------------------------------------===// |
| |
| // <iterator> |
| |
| // template<class charT, class traits = char_traits<charT> > |
| // class istreambuf_iterator |
| // : public iterator<input_iterator_tag, charT, |
| // typename traits::off_type, charT*, |
| // charT> |
| // { |
| // public: |
| // ... |
| // proxy operator++(int); |
| |
| // class proxy |
| // { |
| // public: |
| // charT operator*(); |
| // }; |
| |
| #include <iterator> |
| #include <sstream> |
| #include <cassert> |
| |
| int main() |
| { |
| { |
| std::istringstream inf("abc"); |
| std::istreambuf_iterator<char> i(inf); |
| assert(*i++ == 'a'); |
| } |
| { |
| std::wistringstream inf(L"abc"); |
| std::istreambuf_iterator<wchar_t> i(inf); |
| assert(*i++ == L'a'); |
| } |
| } |