]>
Commit | Line | Data |
---|---|---|
a5544970 | 1 | // Copyright (C) 2015-2019 Free Software Foundation, Inc. |
a623b6f0 JW |
2 | // |
3 | // This file is part of the GNU ISO C++ Library. This library is free | |
4 | // software; you can redistribute it and/or modify it under the | |
5 | // terms of the GNU General Public License as published by the | |
6 | // Free Software Foundation; either version 3, or (at your option) | |
7 | // any later version. | |
8 | ||
9 | // This library is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
15 | // with this library; see the file COPYING3. If not see | |
16 | // <http://www.gnu.org/licenses/>. | |
17 | ||
52066eae | 18 | // { dg-do compile { target c++14 } } |
a623b6f0 JW |
19 | |
20 | // This is a compile-only test with minimal includes | |
21 | #include <experimental/iterator> | |
cb701078 | 22 | #include <iosfwd> // No guarantee that <experimental/iterator> includes this! |
a623b6f0 JW |
23 | |
24 | using namespace std::experimental; | |
25 | ||
26 | template<typename Delim, typename Char> | |
27 | struct tester | |
28 | { | |
29 | using joiner_type = ostream_joiner<Delim, Char>; | |
30 | using ostream_type = std::basic_ostream<Char>; | |
31 | using test_type = decltype(make_ostream_joiner(std::declval<ostream_type&>(), | |
32 | std::declval<Delim>())); | |
33 | ||
34 | static_assert(is_same_v<test_type, joiner_type>, ""); | |
35 | ||
36 | static_assert(is_same_v<typename test_type::char_type, Char>, ""); | |
37 | ||
38 | static_assert(is_same_v<typename test_type::traits_type, | |
39 | std::char_traits<Char>>, ""); | |
40 | ||
41 | static_assert(is_same_v<typename test_type::ostream_type, ostream_type>, ""); | |
42 | ||
43 | static_assert(is_same_v<typename test_type::iterator_category, | |
44 | std::output_iterator_tag>, ""); | |
45 | ||
46 | static_assert(is_same_v<typename test_type::value_type, void>, ""); | |
47 | static_assert(is_same_v<typename test_type::difference_type, void>, ""); | |
48 | static_assert(is_same_v<typename test_type::pointer, void>, ""); | |
49 | static_assert(is_same_v<typename test_type::reference, void>, ""); | |
50 | }; | |
51 | ||
52 | tester<char, char> cc; | |
53 | tester<int, char> ic; | |
54 | #if _GLIBCXX_USE_WCHAR_T | |
55 | tester<wchar_t, wchar_t> ww; | |
56 | tester<int, wchar_t> iw; | |
57 | #endif | |
cb701078 JW |
58 | |
59 | std::ostream& os(); | |
60 | ||
61 | // Ensure that contents of <iterator> are defined by <experimental/iterator>: | |
62 | std::reverse_iterator<int*> ii; | |
63 | std::move_iterator<int*> mi; | |
64 | std::istream_iterator<int> isi; | |
65 | std::ostream_iterator<int> osi(os()); | |
66 | std::istreambuf_iterator<char> isbi; | |
67 | std::ostreambuf_iterator<char> osbi(os()); |