1 // { dg-options "-std=gnu++17" }
3 // Copyright (C) 2013-2018 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // basic_string_view constructors.
27 typedef gdb::string_view::size_type csize_type
;
29 // basic_string_view()
30 const gdb::string_view str00
{};
31 VERIFY( str00
.length() == 0 );
32 VERIFY( str00
.data() == nullptr );
34 // basic_string_view(const char*)
35 const char str_lit01
[] = "rodeo beach, marin";
36 const gdb::string_view str01
{str_lit01
};
37 VERIFY( str01
.length() == 18 );
38 VERIFY( str01
.data() == str_lit01
);
39 const gdb::string_view str02
{"baker beach, san francisco"};
40 VERIFY( str02
.length() == 26 );
42 // basic_string_view(const string_view&)
43 gdb::string_view str04
{str01
};
44 VERIFY( str04
.length() == str01
.length() );
45 VERIFY( str04
.data() == str01
.data() );
47 // basic_string_view(const char* s)
48 csize_type len_lit01
= strlen(str_lit01
);
49 gdb::string_view str05
{str_lit01
, len_lit01
};
50 VERIFY( str05
.length() == len_lit01
);
51 VERIFY( str05
.data() == str_lit01
);
53 // basic_string_view(basic_string& s)
54 std::string
istr07(10, 'z');
55 gdb::string_view str07
{istr07
};
56 VERIFY( str07
.length() == 10 );
This page took 0.029254 seconds and 4 git commands to generate.