]>
Commit | Line | Data |
---|---|---|
ca8f2cb1 VV |
1 | |
2 | // { dg-options "-std=gnu++17" } | |
6458742a | 3 | // { dg-do compile { target c++17 } } |
ca8f2cb1 | 4 | |
99dee823 | 5 | // Copyright (C) 2013-2021 Free Software Foundation, Inc. |
ca8f2cb1 VV |
6 | // |
7 | // This file is part of the GNU ISO C++ Library. This library is free | |
8 | // software; you can redistribute it and/or modify it under the | |
9 | // terms of the GNU General Public License as published by the | |
10 | // Free Software Foundation; either version 3, or (at your option) | |
11 | // any later version. | |
12 | ||
13 | // This library is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | ||
18 | // You should have received a copy of the GNU General Public License along | |
19 | // with this library; see the file COPYING3. If not see | |
20 | // <http://www.gnu.org/licenses/>. | |
21 | ||
22 | #include <string_view> | |
23 | #include <testsuite_containers.h> | |
24 | ||
25 | namespace __gnu_test | |
26 | { | |
27 | template<typename _Tp1, typename _Tp2> | |
28 | struct traits<std::basic_string_view<_Tp1, _Tp2>> : public traits_base | |
29 | { | |
30 | typedef std::true_type is_container; | |
31 | typedef std::true_type is_reversible; | |
32 | }; | |
33 | } | |
34 | ||
35 | #include <testsuite_containers.h> | |
36 | ||
37 | // Check container for required typedefs. | |
38 | ||
39 | __gnu_test::basic_types<std::string_view> t1b; | |
40 | __gnu_test::reversible_types<std::string_view> t1r; | |
41 | typedef typename std::string_view::traits_type traits_type1; | |
42 | ||
43 | #ifdef _GLIBCXX_USE_WCHAR_T | |
44 | __gnu_test::basic_types<std::wstring_view> t2b; | |
45 | __gnu_test::reversible_types<std::wstring_view> t2r; | |
46 | typedef typename std::wstring_view::traits_type traits_type2; | |
47 | #endif | |
fb8b3e29 JW |
48 | |
49 | static_assert(std::is_same<std::string_view::pointer, char*>(), | |
50 | "pointer should be value_type*"); | |
51 | static_assert(std::is_same<std::string_view::const_pointer, const char*>(), | |
52 | "const_pointer should be const value_type*"); | |
53 | static_assert(std::is_same<std::string_view::reference, char&>(), | |
54 | "reference should be value_type&"); | |
55 | static_assert(std::is_same<std::string_view::const_reference, const char&>(), | |
56 | "const_reference should be const value_type&"); |