blob: 2ad927cf952c2a5ac60dd8dae53657655e4a6a3d [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <iterator>
11
12// template<class charT, class traits = char_traits<charT> >
13// class istreambuf_iterator
14// : public iterator<input_iterator_tag, charT,
15// typename traits::off_type, unspecified,
16// charT>
17// {
18// public:
19// typedef charT char_type;
20// typedef traits traits_type;
21// typedef typename traits::int_type int_type;
22// typedef basic_streambuf<charT,traits> streambuf_type;
23// typedef basic_istream<charT,traits> istream_type;
24// ...
Marshall Clowe9d03062015-04-16 21:36:54 +000025//
26// All specializations of istreambuf_iterator shall have a trivial copy constructor,
27// a constexpr default constructor and a trivial destructor.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000028
29#include <iterator>
30#include <string>
31#include <type_traits>
32
33int main()
34{
35 typedef std::istreambuf_iterator<char> I1;
36 static_assert((std::is_convertible<I1,
37 std::iterator<std::input_iterator_tag, char, std::char_traits<char>::off_type,
38 char*, char> >::value), "");
39 static_assert((std::is_same<I1::char_type, char>::value), "");
40 static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), "");
41 static_assert((std::is_same<I1::int_type, I1::traits_type::int_type>::value), "");
42 static_assert((std::is_same<I1::streambuf_type, std::streambuf>::value), "");
43 static_assert((std::is_same<I1::istream_type, std::istream>::value), "");
Marshall Clowe9d03062015-04-16 21:36:54 +000044 static_assert((std::is_nothrow_default_constructible<I1>::value), "" );
45 static_assert((std::is_trivially_copy_constructible<I1>::value), "" );
46 static_assert((std::is_trivially_destructible<I1>::value), "" );
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000047
48 typedef std::istreambuf_iterator<wchar_t> I2;
49 static_assert((std::is_convertible<I2,
50 std::iterator<std::input_iterator_tag, wchar_t, std::char_traits<wchar_t>::off_type,
51 wchar_t*, wchar_t> >::value), "");
52 static_assert((std::is_same<I2::char_type, wchar_t>::value), "");
53 static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), "");
54 static_assert((std::is_same<I2::int_type, I2::traits_type::int_type>::value), "");
55 static_assert((std::is_same<I2::streambuf_type, std::wstreambuf>::value), "");
56 static_assert((std::is_same<I2::istream_type, std::wistream>::value), "");
Marshall Clowe9d03062015-04-16 21:36:54 +000057 static_assert((std::is_nothrow_default_constructible<I2>::value), "" );
58 static_assert((std::is_trivially_copy_constructible<I2>::value), "" );
59 static_assert((std::is_trivially_destructible<I2>::value), "" );
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000060}