]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/experimental/string.view/string.view.cons/default.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / experimental / string.view / string.view.cons / default.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10
11 // <string_view>
12
13 // constexpr basic_string_view () noexcept;
14
15 #include <experimental/string_view>
16 #include <cassert>
17
18 #include "test_macros.h"
19
20 template<typename T>
21 void test () {
22 #if TEST_STD_VER > 11
23     {
24     constexpr T sv1;
25     static_assert ( sv1.size() == 0, "" );
26     static_assert ( sv1.empty(), "");
27     }
28 #endif
29
30     {
31     T sv1;
32     assert ( sv1.size() == 0 );
33     assert ( sv1.empty());
34     }
35 }
36
37 int main () {
38     typedef std::experimental::string_view    string_view;
39     typedef std::experimental::u16string_view u16string_view;
40     typedef std::experimental::u32string_view u32string_view;
41     typedef std::experimental::wstring_view   wstring_view;
42
43     test<string_view> ();
44     test<u16string_view> ();
45     test<u32string_view> ();
46     test<wstring_view> ();
47
48 }