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 T, class charT = char, class traits = char_traits<charT>, 13// class Distance = ptrdiff_t> 14// class ostream_iterator 15// : public iterator<output_iterator_tag, void, void, void, void> 16// { 17// public: 18// typedef charT char_type; 19// typedef traits traits_type; 20// typedef basic_istream<charT,traits> istream_type; 21// ... 22 23#include <iterator> 24#include <type_traits> 25 26int main() 27{ 28 typedef std::ostream_iterator<double> I1; 29 static_assert((std::is_convertible<I1, 30 std::iterator<std::output_iterator_tag, void, void, void, void> >::value), ""); 31 static_assert((std::is_same<I1::char_type, char>::value), ""); 32 static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), ""); 33 static_assert((std::is_same<I1::ostream_type, std::ostream>::value), ""); 34 typedef std::ostream_iterator<unsigned, wchar_t> I2; 35 static_assert((std::is_convertible<I2, 36 std::iterator<std::output_iterator_tag, void, void, void, void> >::value), ""); 37 static_assert((std::is_same<I2::char_type, wchar_t>::value), ""); 38 static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), ""); 39 static_assert((std::is_same<I2::ostream_type, std::wostream>::value), ""); 40} 41