]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/iterator/requirements.cc
1 // Copyright (C) 2015-2016 Free Software Foundation, Inc.
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)
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.
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/>.
18 // { dg-options "-std=gnu++14" }
21 // This is a compile-only test with minimal includes
22 #include <experimental/iterator>
25 using namespace std::experimental
;
27 template<typename Delim
, typename Char
>
30 using joiner_type
= ostream_joiner
<Delim
, Char
>;
31 using ostream_type
= std::basic_ostream
<Char
>;
32 using test_type
= decltype(make_ostream_joiner(std::declval
<ostream_type
&>(),
33 std::declval
<Delim
>()));
35 static_assert(is_same_v
<test_type
, joiner_type
>, "");
37 static_assert(is_same_v
<typename
test_type::char_type
, Char
>, "");
39 static_assert(is_same_v
<typename
test_type::traits_type
,
40 std::char_traits
<Char
>>, "");
42 static_assert(is_same_v
<typename
test_type::ostream_type
, ostream_type
>, "");
44 static_assert(is_same_v
<typename
test_type::iterator_category
,
45 std::output_iterator_tag
>, "");
47 static_assert(is_same_v
<typename
test_type::value_type
, void>, "");
48 static_assert(is_same_v
<typename
test_type::difference_type
, void>, "");
49 static_assert(is_same_v
<typename
test_type::pointer
, void>, "");
50 static_assert(is_same_v
<typename
test_type::reference
, void>, "");
53 tester
<char, char> cc
;
55 #if _GLIBCXX_USE_WCHAR_T
56 tester
<wchar_t, wchar_t> ww
;
57 tester
<int, wchar_t> iw
;