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 // template <class charT, class traits = char_traits<charT> > 13 // class ostreambuf_iterator 14 // : public iterator<output_iterator_tag, void, void, void, void> 15 // { 16 // public: 17 // typedef charT char_type; 18 // typedef traits traits_type; 19 // typedef basic_streambuf<charT, traits> streambuf_type; 20 // typedef basic_ostream<charT, traits> ostream_type; 21 // ... 22 23 #include <iterator> 24 #include <string> 25 #include <type_traits> 26 27 int main() 28 { 29 typedef std::ostreambuf_iterator<char> I1; 30 static_assert((std::is_convertible<I1, 31 std::iterator<std::output_iterator_tag, void, void, void, void> >::value), ""); 32 static_assert((std::is_same<I1::char_type, char>::value), ""); 33 static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), ""); 34 static_assert((std::is_same<I1::streambuf_type, std::streambuf>::value), ""); 35 static_assert((std::is_same<I1::ostream_type, std::ostream>::value), ""); 36 37 typedef std::ostreambuf_iterator<wchar_t> I2; 38 static_assert((std::is_convertible<I2, 39 std::iterator<std::output_iterator_tag, void, void, void, void> >::value), ""); 40 static_assert((std::is_same<I2::char_type, wchar_t>::value), ""); 41 static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), ""); 42 static_assert((std::is_same<I2::streambuf_type, std::wstreambuf>::value), ""); 43 static_assert((std::is_same<I2::ostream_type, std::wostream>::value), ""); 44 } 45