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