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