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 istream_iterator 15 // : public iterator<input_iterator_tag, T, Distance, const T*, const T&> 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 int main() 27 { 28 typedef std::istream_iterator<double> I1; 29 static_assert((std::is_convertible<I1, 30 std::iterator<std::input_iterator_tag, double, std::ptrdiff_t, 31 const double*, const double&> >::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::istream_type, std::istream>::value), ""); 35 typedef std::istream_iterator<unsigned, wchar_t> I2; 36 static_assert((std::is_convertible<I2, 37 std::iterator<std::input_iterator_tag, unsigned, std::ptrdiff_t, 38 const unsigned*, const unsigned&> >::value), ""); 39 static_assert((std::is_same<I2::char_type, wchar_t>::value), ""); 40 static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), ""); 41 static_assert((std::is_same<I2::istream_type, std::wistream>::value), ""); 42 } 43