• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
10 // <string_view>
11 
12 // template<class Allocator>
13 // basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept
14 
15 #include <string_view>
16 #include <string>
17 #include <cassert>
18 
19 struct dummy_char_traits : public std::char_traits<char> {};
20 
main(int,char **)21 int main(int, char**) {
22     using string_view = std::basic_string_view<char>;
23     using string      = std::              basic_string     <char, dummy_char_traits>;
24 
25     {
26     string s{"QBCDE"};
27     string_view sv1 ( s );
28     assert ( sv1.size() == s.size());
29     assert ( sv1.data() == s.data());
30     }
31 
32   return 0;
33 }
34