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