1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <string_view> 10 11 // template<class Allocator> 12 // basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept 13 14 #include <string_view> 15 #include <string> 16 #include <cassert> 17 18 struct dummy_char_traits : public std::char_traits<char> {}; 19 20 int main(int, char**) { 21 using string_view = std::basic_string_view<char>; 22 using string = std:: basic_string <char, dummy_char_traits>; 23 24 { 25 string s{"QBCDE"}; 26 string_view sv1 ( s ); 27 assert ( sv1.size() == s.size()); 28 assert ( sv1.data() == s.data()); 29 } 30 31 return 0; 32 } 33