]>
Commit | Line | Data |
---|---|---|
ca8f2cb1 | 1 | // { dg-options "-std=gnu++17" } |
6458742a | 2 | // { dg-do run { target c++17 } } |
ca8f2cb1 | 3 | |
99dee823 | 4 | // Copyright (C) 2013-2021 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 | // inserters | |
22 | ||
23 | // NB: This file is predicated on sstreams, and ostreams | |
24 | // working, not to mention other major details like char_traits, and | |
25 | // all of the string_view class. | |
26 | ||
27 | #include <string_view> | |
28 | #include <stdexcept> | |
29 | #include <sstream> | |
30 | #include <fstream> | |
31 | #include <iostream> | |
32 | #include <testsuite_hooks.h> | |
33 | ||
118c8424 | 34 | void |
ca8f2cb1 VV |
35 | test01() |
36 | { | |
ca8f2cb1 VV |
37 | typedef std::wstring_view::size_type csize_type; |
38 | typedef std::wstring_view::const_reference cref; | |
39 | typedef std::wstring_view::reference ref; | |
40 | ||
41 | const std::wstring_view str01(L"sailing grand traverse bay\n" | |
42 | L"\t\t\t from Elk Rapids to the point reminds me of miles"); | |
43 | const std::wstring_view str02(L"sailing"); | |
44 | const std::wstring_view str03(L"grand"); | |
45 | const std::wstring_view str04(L"traverse"); | |
46 | const std::wstring_view str05; | |
47 | std::wstring_view str10; | |
48 | ||
49 | // ostream& operator<<(ostream&, const basic_string_view&) | |
50 | std::wostringstream ostrs01; | |
51 | try | |
52 | { | |
53 | ostrs01 << str01; | |
54 | VERIFY( ostrs01.str() == str01 ); | |
55 | } | |
56 | catch(std::exception& fail) | |
57 | { | |
58 | VERIFY( false ); | |
59 | } | |
60 | ||
61 | std::wstring_view hello_world; | |
62 | std::wcout << hello_world; | |
ca8f2cb1 VV |
63 | } |
64 | ||
65 | int | |
66 | main() | |
67 | { | |
68 | test01(); | |
69 | ||
70 | return 0; | |
71 | } |