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 26 #include "test_macros.h" 27 28 int main() 29 { 30 typedef std::ostream_iterator<double> I1; 31 #if TEST_STD_VER <= 14 32 static_assert((std::is_convertible<I1, 33 std::iterator<std::output_iterator_tag, void, void, void, void> >::value), ""); 34 #else 35 static_assert((std::is_same<I1::iterator_category, std::output_iterator_tag>::value), ""); 36 static_assert((std::is_same<I1::value_type, void>::value), ""); 37 static_assert((std::is_same<I1::difference_type, void>::value), ""); 38 static_assert((std::is_same<I1::pointer, void>::value), ""); 39 static_assert((std::is_same<I1::reference, void>::value), ""); 40 #endif 41 static_assert((std::is_same<I1::char_type, char>::value), ""); 42 static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), ""); 43 static_assert((std::is_same<I1::ostream_type, std::ostream>::value), ""); 44 typedef std::ostream_iterator<unsigned, wchar_t> I2; 45 #if TEST_STD_VER <= 14 46 static_assert((std::is_convertible<I2, 47 std::iterator<std::output_iterator_tag, void, void, void, void> >::value), ""); 48 #else 49 static_assert((std::is_same<I2::iterator_category, std::output_iterator_tag>::value), ""); 50 static_assert((std::is_same<I2::value_type, void>::value), ""); 51 static_assert((std::is_same<I2::difference_type, void>::value), ""); 52 static_assert((std::is_same<I2::pointer, void>::value), ""); 53 static_assert((std::is_same<I2::reference, void>::value), ""); 54 #endif 55 static_assert((std::is_same<I2::char_type, wchar_t>::value), ""); 56 static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), ""); 57 static_assert((std::is_same<I2::ostream_type, std::wostream>::value), ""); 58 } 59