1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
13 // void swap(basic_string_view& _other) noexcept
15 #include <experimental/string_view>
18 #include "test_macros.h"
20 template<typename CharT>
21 void test ( const CharT *s, size_t len ) {
22 typedef std::experimental::basic_string_view<CharT> SV;
27 assert ( sv1.size() == len );
28 assert ( sv1.data() == s );
29 assert ( sv2.size() == 0 );
32 assert ( sv1.size() == 0 );
33 assert ( sv2.size() == len );
34 assert ( sv2.data() == s );
40 constexpr size_t test_ce ( size_t n, size_t k ) {
41 typedef std::experimental::basic_string_view<char> SV;
42 SV sv1{ "ABCDEFGHIJKL", n };
43 SV sv2 { sv1.data(), k };
59 #if TEST_STD_VER >= 11
71 static_assert ( test_ce (2, 3) == 3, "" );
72 static_assert ( test_ce (5, 3) == 3, "" );
73 static_assert ( test_ce (0, 1) == 1, "" );